SFML community forums

Help => General => Topic started by: mohragk on October 20, 2020, 04:06:15 pm

Title: LINK2001 error when trying to build in Release mode x64 VS2019
Post by: mohragk on October 20, 2020, 04:06:15 pm
Hi,
I'm using the dynamic version of the library and when building a debug (x64) version, everything works fine (except for font loading).

But, when I try to build a release (x64) version, I get a couple of linker errors:

1>main.obj : error LNK2001: unresolved external symbol "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B)
1>main.obj : error LNK2001: unresolved external symbol "public: static class sf::Color const sf::Color::White" (?White@Color@sf@@2V12@B)
1>main.obj : error LNK2001: unresolved external symbol "public: static class sf::Color const sf::Color::Red" (?Red@Color@sf@@2V12@B)
1>main.obj : error LNK2001: unresolved external symbol "public: static class sf::Color const sf::Color::Cyan" (?Cyan@Color@sf@@2V12@B)
1>C:\dev\paardensprong-sfml\Paardensprong-SFML\x64\Release\Paardensprong-SFML.exe : fatal error LNK1120: 4 unresolved externals
1>Done building project "Paardensprong-SFML.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
 

I've added the following libraries in my project properties> Linker > Input:
sfml-graphics.lib
sfml-window.lib
sfml-audio.lib
sfml-system.lib
opengl32.lib
 


Title: Re: LINK2001 error when trying to build in Release mode x64 VS2019
Post by: mira_strannaya on October 22, 2020, 01:14:53 am
Maybe you added .lib files in the linker options only for debug builds?
Title: Re: LINK2001 error when trying to build in Release mode x64 VS2019
Post by: Kvaz1r on October 22, 2020, 08:17:58 am
Could you attach your project files?
Title: Re: LINK2001 error when trying to build in Release mode x64 VS2019
Post by: eXpl0it3r on October 22, 2020, 09:46:14 am
Sounds like you link SFML dynamically, yet you defined SFML_STATIC.
If you link SFML dynamically, don't define SFML_STATIC.