LNK2019: unresolved external symbol "__declspec(dllimport)

dredogol

18-06-2009 14:44:37

Argh... I can't seem to figure out why I'm getting this error.
I think I'm doing my pointers for QuickGUI correctly...

I have included the (.h) files from QuickGUI into my project solution.
I tried adding all the (.h) files 'physically' into the solution, as a different filter folder, but that did nothing.
I also tried adding mp_guiManager = GameManager::getSingletonPtr()->getGuiManagerPtr(); to my mouse/key injection area, but that also did nothing.

To me, this seems like a DLL / LIB error, but I don't think QuickGUI has a .lib file...

ERROR MESSAGE:
1>IntroState.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QuickGUI::GUIManager::setActiveSheet(class QuickGUI::Sheet *)" (__imp_?setActiveSheet@GUIManager@QuickGUI@@QAEXPAVSheet@2@@Z) referenced in function "public: virtual void __thiscall IntroState::enter(void)" (?enter@IntroState@@UAEXXZ)

1>IntroState.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class QuickGUI::Sheet * __thiscall QuickGUI::SheetManager::createSheet(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool)" (__imp_?createSheet@SheetManager@QuickGUI@@QAEPAVSheet@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N@Z) referenced in function "public: virtual void __thiscall IntroState::enter(void)" (?enter@IntroState@@UAEXXZ)

1>IntroState.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class QuickGUI::SheetManager & __cdecl QuickGUI::SheetManager::getSingleton(void)" (__imp_?getSingleton@SheetManager@QuickGUI@@SAAAV12@XZ) referenced in function "public: virtual void __thiscall IntroState::enter(void)" (?enter@IntroState@@UAEXXZ)

1>IntroState.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall QuickGUI::GUIManager::injectKeyDown(enum QuickGUI::KeyCode const &)" (__imp_?injectKeyDown@GUIManager@QuickGUI@@QAE_NABW4KeyCode@2@@Z) referenced in function "public: virtual void __thiscall IntroState::keyPressed(class OIS::KeyEvent const &)" (?keyPressed@IntroState@@UAEXABVKeyEvent@OIS@@@Z)

1>IntroState.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall QuickGUI::GUIManager::injectChar(unsigned int)" (__imp_?injectChar@GUIManager@QuickGUI@@QAE_NI@Z) referenced in function "public: virtual void __thiscall IntroState::keyPressed(class OIS::KeyEvent const &)" (?keyPressed@IntroState@@UAEXABVKeyEvent@OIS@@@Z)

1>IntroState.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall QuickGUI::GUIManager::injectKeyUp(enum QuickGUI::KeyCode const &)" (__imp_?injectKeyUp@GUIManager@QuickGUI@@QAE_NABW4KeyCode@2@@Z) referenced in function "public: virtual void __thiscall IntroState::keyReleased(class OIS::KeyEvent const &)" (?keyReleased@IntroState@@UAEXABVKeyEvent@OIS@@@Z)

1>IntroState.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall QuickGUI::GUIManager::injectMouseWheelChange(float)" (__imp_?injectMouseWheelChange@GUIManager@QuickGUI@@QAE_NM@Z) referenced in function "public: virtual void __thiscall IntroState::mouseMoved(class OIS::MouseEvent const &)" (?mouseMoved@IntroState@@UAEXABVMouseEvent@OIS@@@Z)

1>IntroState.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall QuickGUI::GUIManager::injectMousePosition(int const &,int const &)" (__imp_?injectMousePosition@GUIManager@QuickGUI@@QAE_NABH0@Z) referenced in function "public: virtual void __thiscall IntroState::mouseMoved(class OIS::MouseEvent const &)" (?mouseMoved@IntroState@@UAEXABVMouseEvent@OIS@@@Z)

1>IntroState.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall QuickGUI::GUIManager::injectMouseButtonDown(enum QuickGUI::MouseButtonID const &)" (__imp_?injectMouseButtonDown@GUIManager@QuickGUI@@QAE_NABW4MouseButtonID@2@@Z) referenced in function "public: virtual void __thiscall IntroState::mousePressed(class OIS::MouseEvent const &,enum OIS::MouseButtonID)" (?mousePressed@IntroState@@UAEXABVMouseEvent@OIS@@W4MouseButtonID@3@@Z)

1>IntroState.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall QuickGUI::GUIManager::injectMouseButtonUp(enum QuickGUI::MouseButtonID const &)" (__imp_?injectMouseButtonUp@GUIManager@QuickGUI@@QAE_NABW4MouseButtonID@2@@Z) referenced in function "public: virtual void __thiscall IntroState::mouseReleased(class OIS::MouseEvent const &,enum OIS::MouseButtonID)" (?mouseReleased@IntroState@@UAEXABVMouseEvent@OIS@@W4MouseButtonID@3@@Z)

1>GameManager.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QuickGUI::GUIManagerDesc::GUIManagerDesc(void)" (__imp_??0GUIManagerDesc@QuickGUI@@QAE@XZ) referenced in function "public: __thiscall GameManager::GameManager(void)" (??0GameManager@@QAE@XZ)

1>GameManager.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QuickGUI::GUIManagerDesc::~GUIManagerDesc(void)" (__imp_??1GUIManagerDesc@QuickGUI@@QAE@XZ) referenced in function "public: virtual __thiscall GameManager::~GameManager(void)" (??1GameManager@@UAE@XZ)

1>GameManager.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class QuickGUI::Root * __cdecl QuickGUI::Root::getSingletonPtr(void)" (__imp_?getSingletonPtr@Root@QuickGUI@@SAPAV12@XZ) referenced in function "public: virtual __thiscall GameManager::~GameManager(void)" (??1GameManager@@UAE@XZ)

1>GameManager.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QuickGUI::Root::~Root(void)" (__imp_??1Root@QuickGUI@@QAE@XZ) referenced in function "public: void * __thiscall QuickGUI::Root::`scalar deleting destructor'(unsigned int)" (??_GRoot@QuickGUI@@QAEPAXI@Z)

1>GameManager.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class QuickGUI::GUIManager * __thiscall QuickGUI::Root::createGUIManager(class QuickGUI::GUIManagerDesc &)" (__imp_?createGUIManager@Root@QuickGUI@@QAEPAVGUIManager@2@AAVGUIManagerDesc@2@@Z) referenced in function "public: void __thiscall GameManager::start(class GameState *)" (?start@GameManager@@QAEXPAVGameState@@@Z)

1>GameManager.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QuickGUI::SkinTypeManager::loadTypes(void)" (__imp_?loadTypes@SkinTypeManager@QuickGUI@@QAEXXZ) referenced in function "public: void __thiscall GameManager::start(class GameState *)" (?start@GameManager@@QAEXPAVGameState@@@Z)

1>GameManager.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class QuickGUI::SkinTypeManager & __cdecl QuickGUI::SkinTypeManager::getSingleton(void)" (__imp_?getSingleton@SkinTypeManager@QuickGUI@@SAAAV12@XZ) referenced in function "public: void __thiscall GameManager::start(class GameState *)" (?start@GameManager@@QAEXPAVGameState@@@Z)

1>GameManager.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QuickGUI::Root::Root(void)" (__imp_??0Root@QuickGUI@@QAE@XZ) referenced in function "public: void __thiscall GameManager::start(class GameState *)" (?start@GameManager@@QAEXPAVGameState@@@Z)

1>GameManager.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl QuickGUI::registerScriptReader(void)" (__imp_?registerScriptReader@QuickGUI@@YAXXZ) referenced in function "public: void __thiscall GameManager::start(class GameState *)" (?start@GameManager@@QAEXPAVGameState@@@Z)

1>bin\Debug\SU09-Project_AlphaEmboreion.exe : fatal error LNK1120: 19 unresolved externals


GameManager.cpp
void GameManager::start (GameState *state)
{
mRoot = new Root();
setupResources();
if (!configure()) return;
TextureManager::getSingleton().setDefaultNumMipmaps (5);
{
QuickGUI::registerScriptReader();
}
ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
{
mp_guiRoot = new QuickGUI::Root();
QuickGUI::SkinTypeManager::getSingleton().loadTypes();
mp_guiManager = QuickGUI::Root::getSingletonPtr()->
createGUIManager (m_guiMngDesc);
}
mInputMgr = InputManager::getSingletonPtr();
mInputMgr->initialise(mRenderWindow);
mInputMgr->addKeyListener (this, "GameManager");
mInputMgr->addMouseListener (this, "GameManager");

mRoot->addFrameListener (this);
changeState (state);
mRoot->startRendering();
}
// ---------------------------------------------------------
QuickGUI::GUIManager* GameManager::getGuiManagerPtr()
{
return mp_guiManager;
}

IntroState.cpp
void IntroState::enter()
{
mp_Root = Root::getSingletonPtr();
mp_SceneMgr = mp_Root->createSceneManager (ST_GENERIC, StringUtil::BLANK);
mp_Camera = mp_SceneMgr->createCamera ("Intro_Camera");
mp_Viewport = mp_Root->getAutoCreatedWindow()->addViewport (mp_Camera);
mp_Viewport->setBackgroundColour (ColourValue(1.0, 1.0, 1.0));
mb_ExitGame = false;

mp_mySheet = QuickGUI::SheetManager::getSingleton().createSheet ("Test.sheet", true);
mp_guiManager = GameManager::getSingletonPtr()->getGuiManagerPtr();
mp_guiManager->setActiveSheet (mp_mySheet);
}
// ---------------------------------------------------------
void IntroState::keyPressed (const OIS::KeyEvent &e)
{
mp_guiManager->injectChar (static_cast<Ogre::UTFString::unicode_char> (e.text));
mp_guiManager->injectKeyDown (static_cast<QuickGUI::KeyCode> (e.key));
}
// ---------------------------------------------------------
void IntroState::keyReleased (const OIS::KeyEvent &e)
{
mp_guiManager->injectKeyUp (static_cast<QuickGUI::KeyCode> (e.key));
}
// ---------------------------------------------------------
void IntroState::mouseMoved (const OIS::MouseEvent &e)
{
mp_guiManager->injectMousePosition (e.state.X.abs, e.state.Y.abs);
float Z = e.state.Z.rel;
if (Z != 0)
mp_guiManager->injectMouseWheelChange (Z);
}
// ---------------------------------------------------------
void IntroState::mousePressed (const OIS::MouseEvent &e, OIS::MouseButtonID id)
{
mp_guiManager->injectMouseButtonDown (static_cast<QuickGUI::MouseButtonID> (id));
}
// ---------------------------------------------------------
void IntroState::mouseReleased (const OIS::MouseEvent &e, OIS::MouseButtonID id)
{
mp_guiManager->injectMouseButtonUp (static_cast<QuickGUI::MouseButtonID> (id));
}

kungfoomasta

18-06-2009 20:51:36

What OS and IDE are you using? Visual Studio?

By default the QuickGUI project should build to create a .dll, and a .lib. In order to use QuickGUI in another project, you need to add the directory to the QuickGUI header files, as well as include the QuickGUI.lib file.

Visual Studio:

Adding Include Directory:
1. Right click Project, Properties.
2. Configuration Properties -> C/C++ -> General
3. Add the path to where the QuickGUI header files are in the "Additional Include Directories" field

Adding QuickGUI.lib to project:
1. Right click Project, Properties.
2. Configuration Properties -> Linker -> General
3. Add the path to where the QuickGUI lib file is in the "Additional Library Directories" field
4. Linker -> Input
5. Add "QuickGUI.lib" to the "Additional Dependencies" field

Its also important to specify the preprocessor definition QUICKGUI_EXPORTS in the QuickGUI project, prior to building it. As you can see in QuickGUIExportDLL.h, this definition, if defined, defines a macro to export definitions, or import definitions. This can be set in QuickGUI"s project settings, C/C++ -> Preprocessor -> Preprocessor Definitions.

ititrx

27-06-2009 15:06:09

Do you have a main(void) included in that code and included in the project if its MV c++?

I have done that before, coded it but not included it in the project..... :)