SFML community forums

Help => General => Topic started by: ajvdv on September 03, 2020, 08:04:22 am

Title: Cmake build of SFML only has lib files for debug
Post by: ajvdv on September 03, 2020, 08:04:22 am
Hey, sort of a two part question here.

I have been following this tutorial (https://www.sfml-dev.org/tutorials/2.5/start-vc.php (https://www.sfml-dev.org/tutorials/2.5/start-vc.php)) am getting the error "cannot open source file SFML\Graphics.hpp" when I try and run the example code at the bottom. I am trying to statically link.

I think I have followed the tutorial to the letter, but because I am using Visual studio 2019, I had to build SFML from using CMake. When I build it, The debug .lib files (with -d suffix) were generated, but not the release. I finished the tutorial anyway, just only linking the debug files. Even when trying to run the example in debug mode, I still get the error.

So two questions:
 - Why is my build only giving me the debug libs?
 - Is the lack of release libs the reason why it won't run? (even though I am running on debug mode)

things I have already done
> added the paths to the lib and include folders in VS (globally)
> linked the debug .lib files (along with their dependencies)
> added the SFML_STATIC macro


These are my CMake options
(https://i.imgur.com/OFZ61cP.png)

Cheers for any help.
Title: Re: Cmake build of SFML only has lib files for debug
Post by: Laurent on September 03, 2020, 09:33:23 am
Quote
Why is my build only giving me the debug libs?
Because you build the Debug configuration in Visual Studio. There's a combo-box to choose the configuration to build. CMAKE_BUILD_TYPE is ignored for Visual Studio, as the IDE is able to handle all the build types from a single solution, directly from the IDE.

Quote
Is the lack of release libs the reason why it won't run?
No, since this is a compile error (lack of libraries would cause a linker error). Most likely, the include path that you configured (globally) is not taken in account.