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

Author Topic: LINK2001 error when trying to build in Release mode x64 VS2019  (Read 2177 times)

0 Members and 1 Guest are viewing this topic.

mohragk

  • Newbie
  • *
  • Posts: 4
    • View Profile
LINK2001 error when trying to build in Release mode x64 VS2019
« 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
 



mira_strannaya

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Personal website
    • Email
Re: LINK2001 error when trying to build in Release mode x64 VS2019
« Reply #1 on: October 22, 2020, 01:14:53 am »
Maybe you added .lib files in the linker options only for debug builds?

Kvaz1r

  • Newbie
  • *
  • Posts: 39
    • View Profile
    • Email
Re: LINK2001 error when trying to build in Release mode x64 VS2019
« Reply #2 on: October 22, 2020, 08:17:58 am »
Could you attach your project files?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: LINK2001 error when trying to build in Release mode x64 VS2019
« Reply #3 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything