1
General / Re: Failing to link release build on Windows
« on: March 27, 2021, 03:34:01 pm »
Hi, I'll explain you my setup since I use SFML on Windows with CMake.
SFML installation
We need CMake system to properly find the SFML library:
Note: obviously you would need to restart the IDE, cmd or anything you use. Sometimes Windows would not expand the PATH entries automatically. To solve this you should use the admin rights or simply sobstitute %SFML_install% with the actual value)
Configurations
I use Visual studio in my project, I create the debug and release configurations. The debug configuration should work fine while the release one would not work since VS will build your project in "RelWithDebInfo" by default, but the SFML are only built in "Debug" ad "Release". You have to edit the release configuration and change "Configuration Type" (not the configuration name) from "RelWithDebInfo" to "Release".
This method works fine for me, but if you want the "RelWithDebInfo" you have to build the SFML library from source... but I did not succeed: https://en.sfml-dev.org/forums/index.php?topic=27949.0
SFML installation
We need CMake system to properly find the SFML library:
- Add a global environment variable, for exaple SFML_install="G:\SFML-2.5.1";
- add the following to PATH:
- "%SFML_install%\lib"
- "%SFML_install%\bin"
- "%SFML_install%\lib\cmake\SFML"
Note: obviously you would need to restart the IDE, cmd or anything you use. Sometimes Windows would not expand the PATH entries automatically. To solve this you should use the admin rights or simply sobstitute %SFML_install% with the actual value)
Configurations
I use Visual studio in my project, I create the debug and release configurations. The debug configuration should work fine while the release one would not work since VS will build your project in "RelWithDebInfo" by default, but the SFML are only built in "Debug" ad "Release". You have to edit the release configuration and change "Configuration Type" (not the configuration name) from "RelWithDebInfo" to "Release".
This method works fine for me, but if you want the "RelWithDebInfo" you have to build the SFML library from source... but I did not succeed: https://en.sfml-dev.org/forums/index.php?topic=27949.0