SFML community forums

Help => General => Topic started by: slotdev on October 06, 2014, 03:31:06 pm

Title: VS2013 linker problems
Post by: slotdev on October 06, 2014, 03:31:06 pm
Hi

Using the latest SFML built with VS2013, when I link my game project I get lots of unresolved externals, stuff like this:

Error   3   error LNK2001: unresolved external symbol __imp__glBindTexture@8   C:\Projects\game\sfml-graphics-s-d.lib(Texture.obj)

Error   7   error LNK2001: unresolved external symbol __imp__glGetIntegerv@8   C:\Projects\game\sfml-graphics-s-d.lib(Texture.obj)

Error   139   error LNK2019: unresolved external symbol __imp__timeGetDevCaps@8 referenced in function "void __cdecl sf::priv::sleepImpl(class sf::Time)" (?sleepImpl@priv@sf@@YAXVTime@2@@Z)   C:\Projects\game\sfml-system-s-d.lib(SleepImpl.obj)


...I have built the SFML libraries as static....so I think this is a problem with the libraries I've build rather than the game. What have I missed.....?

Thanks
Ed
Title: Re: VS2013 linker problems
Post by: zsbzsb on October 06, 2014, 03:32:02 pm
https://github.com/SFML/SFML/wiki/FAQ#build-link-static
Title: Re: VS2013 linker problems
Post by: slotdev on October 06, 2014, 05:06:58 pm
Thanks for the link, seems quite a lot has changed since I last built SFML about 12 months ago! I have added all .lib files necessary, and now down to 8 errors....so what is missing?!

Error   5   error LNK2019: unresolved external symbol __imp__SwapBuffers@4 referenced in function "public: virtual void __thiscall sf::priv::WglContext::display(void)" (?display@WglContext@priv@sf@@UAEXXZ)   C:\Projects\game3\sfml-window-s-d.lib(WglContext.obj)

Error   4   error LNK2019: unresolved external symbol __imp__SetPixelFormat@12 referenced in function "private: void __thiscall sf::priv::WglContext::createContext(class sf::priv::WglContext *,unsigned int,struct sf::ContextSettings const &)"
(?createContext@WglContext@priv@sf@@AAEXPAV123@IABUContextSettings@3@@Z)   C:\Projects\game\sfml-window-s-d.lib(WglContext.obj)

Error   8   error LNK2019: unresolved external symbol __imp__RegQueryValueExW@24 referenced in function "class sf::String __cdecl `anonymous namespace'::getDeviceName(unsigned int,struct tagJOYCAPSW)" (?getDeviceName@?A0x53009e8c@@YA?AVString@sf@@IUtagJOYCAPSW@@@Z)   C:\Projects\game\sfml-window-s-d.lib(JoystickImpl.obj)

Error   7   error LNK2019: unresolved external symbol __imp__RegOpenKeyExW@20 referenced in function "class sf::String __cdecl `anonymous namespace'::getDeviceName(unsigned int,struct tagJOYCAPSW)" (?getDeviceName@?A0x53009e8c@@YA?AVString@sf@@IUtagJOYCAPSW@@@Z)   C:\Projects\game\sfml-window-s-d.lib(JoystickImpl.obj)

Error   6   error LNK2019: unresolved external symbol __imp__RegCloseKey@4 referenced in function "class sf::String __cdecl `anonymous namespace'::getDeviceName(unsigned int,struct tagJOYCAPSW)" (?getDeviceName@?A0x53009e8c@@YA?AVString@sf@@IUtagJOYCAPSW@@@Z)   C:\Projects\game\sfml-window-s-d.lib(JoystickImpl.obj)

Error   3   error LNK2019: unresolved external symbol __imp__DescribePixelFormat@16 referenced in function "private: void __thiscall sf::priv::WglContext::createContext(class sf::priv::WglContext *,unsigned int,struct sf::ContextSettings const &)" (?createContext@WglContext@priv@sf@@AAEXPAV123@IABUContextSettings@3@@Z)   C:\Projects\game\sfml-window-s-d.lib(WglContext.obj)

Error   2   error LNK2019: unresolved external symbol __imp__ChoosePixelFormat@8 referenced in function "private: void __thiscall sf::priv::WglContext::createContext(class sf::priv::WglContext *,unsigned int,struct sf::ContextSettings const &)" (?createContext@WglContext@priv@sf@@AAEXPAV123@IABUContextSettings@3@@Z)   C:\Projects\game\sfml-window-s-d.lib(WglContext.obj)


Here's all my .lib files:
C:\SFML\SFML21_031014\extlibs\libs-msvc\x86\freetype.lib
C:\SFML\SFML21_031014\extlibs\libs-msvc\x86\glew.lib
C:\SFML\SFML21_031014\extlibs\libs-msvc\x86\jpeg.lib
C:\SFML\SFML21_031014\extlibs\libs-msvc\x86\openal32.lib
C:\SFML\SFML21_031014\extlibs\libs-msvc\x86\sndfile.lib
C:\SFML\SFML21_031014\lib\debug\sfml-graphics-s-d.lib
C:\SFML\SFML21_031014\lib\debug\sfml-window-s-d.lib
C:\SFML\SFML21_031014\lib\debug\sfml-system-s-d.lib
C:\SFML\SFML21_031014\lib\debug\sfml-audio-s-d.lib
C:\SFML\SFML21_031014\lib\debug\sfml-main-d.lib
C:\SFML\SFML21_031014\lib\debug\sfml-network-s-d.lib
winmm.lib
opengl32.lib
ws2_32.lib
Kernel32.lib
User32.lib
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib
odbccp32.lib

Thanks again :)
Title: Re: VS2013 linker problems
Post by: binary1248 on October 06, 2014, 05:18:34 pm
Strange... those symbols are supposed to be in gdi32.lib and advapi32.lib. Did you try rebuilding from scratch? If that doesn't help, you could try inspecting the build output (http://en.sfml-dev.org/forums/index.php?topic=12552.0). Often times, Visual Studio likes to play tricks on the unknowing ::).
Title: Re: VS2013 linker problems
Post by: slotdev on October 06, 2014, 05:31:43 pm
Ah ha!

So adding gdi32.lib and advapi32.lib to my linker input worked - for some reason, even though gdi32.lib was already in the "inherited" area it didn't work....

Thanks for your help, game is now up and running :)