I've created an DLL for my Console Application in Visual Studio. In my DLL I have a Class named Dialog_MainMenu with has a *.cpp file and a *.h file.
Following error message:
Error 9 error LNK2001: unresolved external symbol "__declspec(dllimport) public: static enum Dialog_MainMenu::GAME_STATES Dialog_MainMenu::CurrentGameState" (_imp?CurrentGameState@Dialog_MainMenu@@2W4GAME_STATES@1@A) C:\Users\Kevin\Desktop\c++ projects\development_testing\The Intense Adventure\Dialogs\Dialog_MainMenu.obj Dialogs
Which I kinda don't understand. This only occured when I added an enum to my prototype in my header file.
Header file:
#ifdef DIALOG_MAINMENU_EXPORTS
#define DIALOG_MAINMENU_API __declspec(dllexport)
#else
#define DIALOG_MAINMENU_API __declspec(dllimport)
#endif
class Dialog_MainMenu {
public:
static DIALOG_MAINMENU_API enum GAME_STATES {
MAINMENU, GAME, OPTIONS, CREDITS, QUIT
};
static DIALOG_MAINMENU_API GAME_STATES CurrentGameState;
DIALOG_MAINMENU_API GAME_STATES GetState();
};
(Don't know if issue lies here, so I'll just add it) cpp file in general:
//Get state
Dialog_MainMenu::GAME_STATES Dialog_MainMenu::GetState() {
// Code..
}
//Switching state
Dialog_MainMenu::CurrentGameState = Dialog_MainMenu::GAME_STATES::GAME;
I would really appreciate, any help or atleast some advice, where I can learn more about this problem.
static
andDIALOG_MAINMENU_API
inenum GAME_STATES
. – Agonic