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

Author Topic: Doesn't link in VS 2022 - expected?  (Read 270 times)

0 Members and 1 Guest are viewing this topic.

SuperFunMegaLazy

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Doesn't link in VS 2022 - expected?
« on: November 18, 2023, 05:10:23 am »
I'm compiling against 2.6.1, and am including

#pragma comment( lib, "sfml-main.lib")
#pragma comment( lib, "sfml-graphics.lib")
#pragma comment( lib, "sfml-system.lib")
#pragma comment( lib, "sfml-window.lib")

in my program, and when it links, on the sample tut, it can't find Green (the static color), and it can't find external symbol static class sf::RenderStates const sf::RenderStates::Default.

Has anybody else seen this?
a

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10851
    • View Profile
    • development blog
    • Email
Re: Doesn't link in VS 2022 - expected?
« Reply #1 on: November 18, 2023, 08:09:29 am »
I recommend to either use the project properties to configure your linker configuration, see the official tutorial, or use the CMake Project Template, which will automatically download and configure SFML.

Using #pragma comment isn't crossplatform and thus you're coupling your code to VS.

Make sure you're not setting SFML_STATIC if you're link SFML dynamically.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything