SFML community forums

Help => General => Topic started by: TaCqz on December 22, 2016, 02:36:03 pm

Title: Can't get SFML working with Visual Studio 2015
Post by: TaCqz on December 22, 2016, 02:36:03 pm
Hello guys,
I followed the official tutorial step-by-step but cant reach it to work. I copied the example code into my main.cpp, but when compiling in "Debug" I get this error:

Severity        Code    Description     Project File    Line    Suppression State
Error   LNK1112 module machine type 'x64' conflicts with target machine type 'X86'      Win32Project1   G:\decision\Win32Project1\Win32Project1\sfml-graphics-s-d.lib(RenderStates.cpp.obj)     1      
 

I am using Visual Studio 2015 with SFML 2.4.1 and linked every .lib file (including sfml-main.lib). I am using the static version of SFML. Any Ideas? If I missed something, feel free to ask the information that needs to be provided:)

Title: Re: Can't get SFML working with Visual Studio 2015
Post by: Laurent on December 22, 2016, 03:34:43 pm
The error message is pretty clear: you try to use 64-bit libraries in a 32-bit project.
Title: Re: Can't get SFML working with Visual Studio 2015
Post by: TaCqz on December 22, 2016, 03:45:51 pm
The error message is pretty clear: you try to use 64-bit libraries in a 32-bit project.

Just noticed that too.. But using the 32 Bit Version of SFML did not resolve the error, I get a way longer Error-Message now. Any ideas? :/

Error-Message (Example, getting 67 of those):

Severity        Code    Description     Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol _glClear@4 referenced in function "public: void __thiscall sf::RenderTarget::clear(class sf::Color const &)" (?clear@RenderTarget@sf@@QAEXABVColor@2@@Z)     Win32Project1   G:\decision\Win32Project1\Win32Project1\sfml-graphics-s-d.lib(RenderTarget.cpp.obj)     1      
 
Title: Re: Can't get SFML working with Visual Studio 2015
Post by: Laurent on December 22, 2016, 03:54:35 pm
As explained in the "getting started" tutorial, if you link SFML statically you must link all its dependencies as well.
Title: Re: Can't get SFML working with Visual Studio 2015
Post by: TaCqz on December 22, 2016, 03:56:38 pm
As explained in the "getting started" tutorial, if you link SFML statically you must link all its dependencies as well.

Actually I linked everything..

EDIT: Do I have to link them in both, debug and release?
Title: Re: Can't get SFML working with Visual Studio 2015
Post by: eXpl0it3r on December 22, 2016, 04:05:05 pm
If you want to build debug and release builds, yes.  ;)
Title: Re: Can't get SFML working with Visual Studio 2015
Post by: Laurent on December 22, 2016, 04:05:17 pm
Which libraries did you link? If possible, post your full linker command.
Title: Re: Can't get SFML working with Visual Studio 2015
Post by: TaCqz on December 22, 2016, 04:09:52 pm
Which libraries did you link? If possible, post your full linker command.

Debug:
sfml-audio-s-d.lib;sfml-graphics-s-d.lib;sfml-system-s-d.lib;sfml-window-s-d.lib;sfml-main-d.lib;flac.lib;freetype.lib;jpeg.lib;ogg.lib;openal32.lib;vorbis.lib;vorbisenc.lib;vorbisfile.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;%(AdditionalDependencies)

Release:
sfml-audio-s.lib;sfml-graphics-s.lib;sfml-main.lib;sfml-network-s.lib;sfml-system-s.lib;sfml-window-s.lib;flac.lib;freetype.lib;jpeg.lib;ogg.lib;openal32.lib;vorbis.lib;vorbisenc.lib;vorbisfile.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;%(AdditionalDependencies)
Title: Re: Can't get SFML working with Visual Studio 2015
Post by: Laurent on December 22, 2016, 04:12:46 pm
opengl32.lib is missing
Title: Re: Can't get SFML working with Visual Studio 2015
Post by: TaCqz on December 22, 2016, 04:16:57 pm
opengl32.lib is missing

I can't thank you enough! Thanks for the patience! :D
#