B
Bryan Parkoff
MPU_Group is the namespace and MPU is the struct. Three members: A, B,
and C are in the MPU struct inside MPU_Group namespace. I tried to compile,
but it shows error saying MPU struct is not member in MPU_Group namespace.
Here is my code below. Please advise how to fix error?
// Load.h
namespace MPU_GROUP
{
struct _MPU
{
unsigned int A;
unsigned int B;
unsigned int C;
};
} // namespace MPU_GROUP
// Load.cpp
#include "Load.h"
namespace MPU_GROUP
{
_MPU MPU;
} // namespace MPU_GROUP
// Main.cpp
#include <stdio.h>
#include "Load.h"
void main (void)
{
MPU_GROUP::MPU.A = 0x41;
printf("Hello...\n");
}
Error Compiling
Load.cpp
Main.cpp
d:\test\main.cpp(6) : error C2039: 'MPU' : is not a member of 'MPU_GROUP'
d:\test\main.cpp(6) : error C2065: 'MPU' : undeclared identifier
d:\test\main.cpp(6) : error C2228: left of '.A' must have class/struct/union
type
Error executing cl.exe.
Test.exe - 3 error(s), 0 warning(s)
Bryan Parkoff
and C are in the MPU struct inside MPU_Group namespace. I tried to compile,
but it shows error saying MPU struct is not member in MPU_Group namespace.
Here is my code below. Please advise how to fix error?
// Load.h
namespace MPU_GROUP
{
struct _MPU
{
unsigned int A;
unsigned int B;
unsigned int C;
};
} // namespace MPU_GROUP
// Load.cpp
#include "Load.h"
namespace MPU_GROUP
{
_MPU MPU;
} // namespace MPU_GROUP
// Main.cpp
#include <stdio.h>
#include "Load.h"
void main (void)
{
MPU_GROUP::MPU.A = 0x41;
printf("Hello...\n");
}
Error Compiling
Load.cpp
Main.cpp
d:\test\main.cpp(6) : error C2039: 'MPU' : is not a member of 'MPU_GROUP'
d:\test\main.cpp(6) : error C2065: 'MPU' : undeclared identifier
d:\test\main.cpp(6) : error C2228: left of '.A' must have class/struct/union
type
Error executing cl.exe.
Test.exe - 3 error(s), 0 warning(s)
Bryan Parkoff