I'm having an unresolved external symbol error for two variables defined in a namespace. This is the code I have in my header and source file defining and declaring my variables.
header file
#include "States.h"
namespace acro {
namespace states {
extern States_t feedback;
extern States_t down;
}
}
source file
namespace acro {
namespace states {
States_t feedback;
States_t down;
}
}
In my main file I'm calling this.
printf("Iteration: %lld\n", acro::states::feedback.i);
But I receive this error.
Error LNK2001 unresolved external symbol "class States_t acro::states::feedback" (?feedback@states@acro@@3VStates_t@@A) simple_acrophobe C:\Users\...\main.obj
States_t is class defined in the "Stated.h" an "States.cpp" file which I know works and is properly included in the project. I tested it by declaring an object in the main function. I'm quite certain I've included my header and source files properly. I created them using the Visual Studio UI. There is nothing else in these files except for a header guard and some comments with documentation.
I've ran out of ideas on what could be going wrong here.