VS 2013 unresolved external symbol
« on: 23 February 2015, 23:09:48 »
Code: [Select]
1>Game.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl tgui::Gui::Gui(class sf::RenderWindow &)" (__imp_??0Gui@tgui@@QEAA@AEAVRenderWindow@sf@@@Z) referenced in function "public: void __cdecl Game::Update(void)" (?Update@Game@@QEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl tgui::Gui::Gui(class sf::RenderWindow &)" (__imp_??0Gui@tgui@@QEAA@AEAVRenderWindow@sf@@@Z)


1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::ClickableWidget::leftMousePressed(float,float)" (?leftMousePressed@ClickableWidget@tgui@@UEAAXMM@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::EditBox::leftMousePressed(float,float)" (?leftMousePressed@EditBox@tgui@@UEAAXMM@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::ClickableWidget::leftMouseReleased(float,float)" (?leftMouseReleased@ClickableWidget@tgui@@UEAAXMM@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Widget::mouseEnteredWidget(void)" (?mouseEnteredWidget@Widget@tgui@@UEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Widget::mouseLeftWidget(void)" (?mouseLeftWidget@Widget@tgui@@UEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::EditBox::mouseMoved(float,float)" (?mouseMoved@EditBox@tgui@@UEAAXMM@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Widget::mouseMoved(float,float)" (?mouseMoved@Widget@tgui@@UEAAXMM@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Widget::mouseNoLongerDown(void)" (?mouseNoLongerDown@Widget@tgui@@UEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Widget::mouseNotOnWidget(void)" (?mouseNotOnWidget@Widget@tgui@@UEAAXXZ)

1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Button::setSize(float,float)" (?setSize@Button@tgui@@UEAAXMM@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::EditBox::setSize(float,float)" (?setSize@EditBox@tgui@@UEAAXMM@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Label::setSize(float,float)" (?setSize@Label@tgui@@UEAAXMM@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Picture::setSize(float,float)" (?setSize@Picture@tgui@@UEAAXMM@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Button::setTransparency(unsigned char)" (?setTransparency@Button@tgui@@UEAAXE@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::EditBox::setTransparency(unsigned char)" (?setTransparency@EditBox@tgui@@UEAAXE@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Picture::setTransparency(unsigned char)" (?setTransparency@Picture@tgui@@UEAAXE@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Widget::setTransparency(unsigned char)" (?setTransparency@Widget@tgui@@UEAAXE@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Widget::show(void)" (?show@Widget@tgui@@UEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::EditBox::textEntered(unsigned int)" (?textEntered@EditBox@tgui@@UEAAXI@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Widget::textEntered(unsigned int)" (?textEntered@Widget@tgui@@UEAAXI@Z)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Widget::unfocus(void)" (?unfocus@Widget@tgui@@UEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __cdecl tgui::EditBox::update(void)" (?update@EditBox@tgui@@MEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Widget::update(void)" (?update@Widget@tgui@@UEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Button::widgetFocused(void)" (?widgetFocused@Button@tgui@@UEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Widget::widgetFocused(void)" (?widgetFocused@Widget@tgui@@UEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::EditBox::widgetUnfocused(void)" (?widgetUnfocused@EditBox@tgui@@UEAAXXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl tgui::Widget::widgetUnfocused(void)" (?widgetUnfocused@Widget@tgui@@UEAAXXZ)
1>C:\Users\ashleybeshir\documents\visual studio 2013\Projects\Reality_Hits_2D\x64\Debug\Reality_Hits_2D.exe : fatal error LNK1120: 101 unresolved externals

i get this weird error. tried the tutorial code first part

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: VS 2013 unresolved external symbol
« Reply #1 on: 23 February 2015, 23:18:25 »
Are you linking with TGUI?
If so, make sure that you are linking the same way as to sfml. If you use the static sfml libraries then you must also use the static tgui libraries, or u must use dynamic libs for both.

If you checked and believe you have everything set up correctly then attach your .vcxproj file so that I can have a look at it.

Re: VS 2013 unresolved external symbol
« Reply #2 on: 24 February 2015, 00:16:51 »
its all dynamic both sfml and tgui

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: VS 2013 unresolved external symbol
« Reply #3 on: 24 February 2015, 00:19:56 »
That is the wrong file :), I need the project file.

Re: VS 2013 unresolved external symbol
« Reply #4 on: 24 February 2015, 00:28:08 »
i think this one is it

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: VS 2013 unresolved external symbol
« Reply #5 on: 24 February 2015, 00:40:48 »
Your project indeed seems to be set up correctly.
You could test one thing though: changing the order of the libraries that you link. Although I doubt that it will make much of a difference because only the sfml libs are mentioned in the wrong order and it shouldn't really matter with dynamic linking.

I guess I will have to test it here myself.
Are you using the precompiled VS2013 libraries from both SFML and TGUI? (or did you compile one of them yourself?)
Could you perhaps upload your full project including the sfml and tgui libraries and header (the entire folders basically) somewhere (e.g. dropbox)? Then I can test with identical circumstances and swap libraries to see if it changes anything.

PS: It is already late here, I will have a look at it tomorrow.
« Last Edit: 24 February 2015, 00:42:32 by texus »

Re: VS 2013 unresolved external symbol
« Reply #6 on: 24 February 2015, 00:51:18 »
https://www.dropbox.com/s/6opjn0tvvszowiy/Projects.rar?dl=0

here u go . there other classes but those arent included in main for test purposes

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: VS 2013 unresolved external symbol
« Reply #7 on: 24 February 2015, 00:58:09 »
I notice several x64 folders in the project. Are you by any chance building for 64-bit and using the 64-bit sfml libraries? Because the tgui libraries are compiled for 32-bit. If you are using the x64 target then you must recompile tgui in the same way.

If that is not the problem then I will have a more thorough look at these files tomorrow.

Re: VS 2013 unresolved external symbol
« Reply #8 on: 24 February 2015, 01:00:03 »
how do recompile tgui to 32bit ? there isnt any download for 64bit tgui

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: VS 2013 unresolved external symbol
« Reply #9 on: 24 February 2015, 12:15:44 »
I have never compiled for 64bit before on windows, so I can't give you an exact guide, but it should be similar to compiling tgui normally. You must have made changes in your project to compile for x64, you just have to make the same changes when compiling tgui.

Follow the visual studio with cmake tutorial for how to build tgui.
In case you have different sfml versions on your pc: when cmake prints "Found SFML: SFML_Path/include", then check that SFML_Path/lib contains your 64-bit sfml libs.
When opening the VS project to compile tgui after running cmake, you have to somehow set the target to x64 before building.