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

Author Topic: Problem with linking SFML. Linker Tools Error LNK2019  (Read 1644 times)

0 Members and 1 Guest are viewing this topic.

Logitechnological1245

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Problem with linking SFML. Linker Tools Error LNK2019
« on: February 10, 2023, 03:46:44 pm »
HI. I finished downloading SFML to my machine. I configured the configuration settings for C++ in Visual Studio 2022. All I did was follow the tutorial from SFML and Visual Studio on the SFML website. Those were in in the C/C++ > General page for Additional Directories and Linker > General. In all that's the headers and libraries.

When I compile the main code on the website to see if its working I get the following error:

Severity   Code   Description   Project   File   Line   Suppression State
Error   LNK2019   unresolved external symbol "__declspec(dllimport) public: __cdecl sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QEAA@III@Z) referenced in function main   ApplicationSFMLtest   C:\Users\*******\source\repos\ApplicationSFMLtest\ApplicationSFMLtest\ApplicationSFMLtest.obj   1   


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Problem with linking SFML. Linker Tools Error LNK2019
« Reply #1 on: February 10, 2023, 03:56:34 pm »
Do you link SFML, i.e. did you specify the necessary *.lib files?

What version of SFML did you download?

One alternative would be to use the SFML CMake template, it configures SFML automatically for you.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Logitechnological1245

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Problem with linking SFML. Linker Tools Error LNK2019
« Reply #2 on: February 10, 2023, 08:11:13 pm »
OK!! I'm back. Thanks for the replay.
Yes. I linked the *.lib files in project configuration in properties. I did everything as the tutorial said. But maybe your right and I should use the CMake method. If it configures SFML for me Il use it.
I'm using version 2.5.1 of SFML. And its the 32 bit version.

Logitechnological1245

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Problem with linking SFML. Linker Tools Error LNK2019
« Reply #3 on: February 13, 2023, 08:27:18 pm »
Hi its me again. I downloaded the template for CMake that you said in the last replay. I'm struggling to understand how to configure it. Could you explain it to me?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Problem with linking SFML. Linker Tools Error LNK2019
« Reply #4 on: February 13, 2023, 10:14:50 pm »
The readme of that repo should contain all the information you need. What are you struggling to understand?

If you want, you can also join our Discord Server, so you get a fast iteration on asking questions and getting answers.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Logitechnological1245

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Problem with linking SFML. Linker Tools Error LNK2019
« Reply #5 on: February 15, 2023, 04:31:26 pm »
HI sorry for taking so long to replay. Thanks you for answering my questions and having patience.  ;D I used CMake using the readme from the repo. Its worked. But I still get the link errors in Visual Studio. Il try something later anyway.