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

Author Topic: Can't get SFML working with Visual Studio 2015  (Read 4059 times)

0 Members and 1 Guest are viewing this topic.

TaCqz

  • Newbie
  • *
  • Posts: 5
    • View Profile
Can't get SFML working with Visual Studio 2015
« 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:)


Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Can't get SFML working with Visual Studio 2015
« Reply #1 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.
Laurent Gomila - SFML developer

TaCqz

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Can't get SFML working with Visual Studio 2015
« Reply #2 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      
 

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Can't get SFML working with Visual Studio 2015
« Reply #3 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.
Laurent Gomila - SFML developer

TaCqz

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Can't get SFML working with Visual Studio 2015
« Reply #4 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?
« Last Edit: December 22, 2016, 03:58:37 pm by TaCqz »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Can't get SFML working with Visual Studio 2015
« Reply #5 on: December 22, 2016, 04:05:05 pm »
If you want to build debug and release builds, yes.  ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Can't get SFML working with Visual Studio 2015
« Reply #6 on: December 22, 2016, 04:05:17 pm »
Which libraries did you link? If possible, post your full linker command.
Laurent Gomila - SFML developer

TaCqz

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Can't get SFML working with Visual Studio 2015
« Reply #7 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)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Can't get SFML working with Visual Studio 2015
« Reply #8 on: December 22, 2016, 04:12:46 pm »
opengl32.lib is missing
Laurent Gomila - SFML developer

TaCqz

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Can't get SFML working with Visual Studio 2015
« Reply #9 on: December 22, 2016, 04:16:57 pm »
opengl32.lib is missing

I can't thank you enough! Thanks for the patience! :D
#
« Last Edit: December 22, 2016, 05:20:06 pm by TaCqz »

 

anything