Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Lots of unresolved externals...  (Read 3368 times)

0 Members and 1 Guest are viewing this topic.

Splux

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Lots of unresolved externals...
« on: April 12, 2012, 02:15:02 am »
****NOTE****
Thread can be locked, re-built it using CMake and NMake instead of CMake and then build the solution from VS11, that did the trick.
(at least now I know how to do it properly for my next time!)
Anyway, thanks for trying to help me Laurent.

TO THOSE OF YOU WHO HAD THE SAME PROBLEM: http://sfmlcoder.wordpress.com/2011/06/15/building-sfml-2-nmake/
Follow that guide, it's made for VS10 but works just as fine for VS11.

Hi, I'm trying to get SFML2 to actually work for me... but, it refuses to just simply work. Therefore, after googling and searching on the forums (only answer I got from the forum was "make sure you have linked the libs", which I have done)... so, here I am - trying to make this work once and for all.

My problem: I'm using VS11 and it doesn't like my linkings, I guess.
Code: [Select]
1>------ Build started: Project: SFML2-Test, Configuration: Debug Win32 ------
1>Build started 2012-04-12 02:02:33.
1>InitializeBuildStatus:
1>  Touching "Debug\SFML2-Test.unsuccessfulbuild".
1>ClCompile:
1>  main.cpp
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::isOpen(void)const " (__imp_?isOpen@Window@sf@@QBE_NXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::display(void)" (__imp_?display@Window@sf@@QAEXXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Color::Color(unsigned char,unsigned char,unsigned char,unsigned char)" (__imp_??0Color@sf@@QAE@EEEE@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::RenderTarget::clear(class sf::Color const &)" (__imp_?clear@RenderTarget@sf@@QAEXABVColor@2@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,struct sf::ContextSettings const &)" (__imp_??0RenderWindow@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IABUContextSettings@1@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (__imp_??1RenderWindow@sf@@UAE@XZ) referenced in function _main
1>c:\users\nti\documents\visual studio 11\Projects\SFML2-Test\Debug\SFML2-Test.exe : fatal error LNK1120: 7 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.76
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

That's my output log, and here's my testcode to see if everything's working:
Code: [Select]
#include <SFML\Graphics.hpp>

int main()
{
sf::RenderWindow mainWindow(sf::VideoMode(800, 600, 32), "title");
while (mainWindow.isOpen())
{
mainWindow.clear(sf::Color(255, 255, 255));
mainWindow.display();
}

return 0;
}

Additional dependencies for Debug (which is what I'm trying to do right now, so my dependencies for Release doesn't matter right now - though it doesn't work there either..):
sfml-graphics-d.lib
sfml-audio-d.lib
sfml-window-d.lib
sfml-system-d.lib
sfml-network-d.lib

So, can someone tell me where I've screwed up?

At first I just thought it was somewhere with the CMake that didn't go well because I got an error, but I rebuilt it and got past that without any errors at all so I guess it should (observe, SHOULD) be working... in my world at least.

Tell me if you need any more info, and I'll happely give it to you if that might help someone help me.

Regard, me.

NOTE: It's 2:15 here, in the night - so I blame any misspellings and such on the time.

*edit*
Tried to rebuild all dll's and lib's, placing the new ones on a completely different place and I think you can guess how it went...

And I'm using CMake's VS11 Win64 setup for my build. And yes, I am running a 64-bit version of Windows 7. Also using an AMD GPU, seen something about SFML and AMD GPU's, but that'd not cause the linker errors...
« Last Edit: April 12, 2012, 02:43:01 pm by Splux »

igorko

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Lots of unresolved externals...
« Reply #1 on: April 12, 2012, 07:28:30 am »
I think your problem is you are using #include <SFML\Graphics.hpp> but you need #include <Window.hpp> (or both?). Also don't link your app with SFML libs you are not using.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Lots of unresolved externals...
« Reply #2 on: April 12, 2012, 08:01:27 am »
Everthing looks ok, are you sure that you're not mixing with another, incompatible version of SFML?

What error did you first get with CMake, and what options did you use to configure SFML?

Quote
I think your problem is you are using #include <SFML\Graphics.hpp> but you need #include <Window.hpp>
The former includes the latter, and that wouldn't cause linker errors anyway.
Laurent Gomila - SFML developer

Splux

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: Lots of unresolved externals...
« Reply #3 on: April 12, 2012, 01:43:51 pm »
Laurent:
It shouldn't matter that I have another project in my Project's folder that uses SFML1.6, or?

Oh, the errors was not from CMake, it was a bug from VS11 (and VS10) that was messing with me for a while, I solved it by not using the pop-up to add "Additional Dependencies" and just add them there.

igorko:
Just trying, if I ever get this working I will remove unused lib's.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Lots of unresolved externals...
« Reply #4 on: April 12, 2012, 01:51:55 pm »
Quote
It shouldn't matter that I have another project in my Project's folder that uses SFML1.6, or?
It doesn't matter, if things are under control. Unfortunately, many people end up mixing versions by accident, because of search paths priority or hidden/forgotten settings in their IDE.
Laurent Gomila - SFML developer

Splux

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: Lots of unresolved externals...
« Reply #5 on: April 12, 2012, 02:01:38 pm »
Laurent:
Well, I can't find anything in this project that has anything to do with SFML1.6 so then that should not be an issue, unless VS11 is too stupid to realize it's a new project and still find the settings for that project (not that likely...).

Well, going to try re-building it again with NMake and follow another tutorial step-by-step and hope that it'll work this time.

Wish me luck, I think I'm gonna need it...

 

anything