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

Author Topic: Linking error (LNK 2019) with sf::Sprite  (Read 1781 times)

0 Members and 1 Guest are viewing this topic.

hoenchioma

  • Newbie
  • *
  • Posts: 4
    • View Profile
Linking error (LNK 2019) with sf::Sprite
« on: November 02, 2018, 09:58:16 pm »
After working with a project for quite while now using SFML these come up.
Code: [Select]

Severity    Code    Description    Project    File    Line    Suppression State
Error    LNK2019    unresolved external symbol "declspec(dllimport) public: thiscall sf::Sprite::Sprite(class sf::Sprite &&)" (imp_??0Sprite@sf@@QAE@$$QAV01@@Z) referenced in function "public: thiscall Boss2::Undead::Undead(class Boss2::Undead &&)" (??0Undead@Boss2@@QAE@$$QAV01@@Z)    Somber    C:\Users\\Documents\Visual Studio 2017\TEAM\Somber\Boss2.obj    1
Severity    Code    Description    Project    File    Line    Suppression State
Error    LNK2019    unresolved external symbol "declspec(dllimport) public: class sf::Sprite & thiscall sf::Sprite::operator=(class sf::Sprite &&)" (imp_??4Sprite@sf@@QAEAAV01@$$QAV01@@Z) referenced in function "public: class Boss2::Undead & thiscall Boss2::Undead::operator=(class Boss2::Undead &&)" (??4Undead@Boss2@@QAEAAV01@$$QAV01@@Z)    Somber    C:\Users\\Documents\Visual Studio 2017\TEAM\Somber\Boss2.obj    1

Here Undead is a class with a constructor like,
Code: [Select]
Undead(sf::Texture *texture1, sf::Texture *texture2, sf::Texture *texture3);
It has an sf::Sprite member. This sets one of the 3 textures to the sprite member based on some internal calculations.
Then I've used a vector of it (in another class/file) and pushed versions of it like this
Code: [Select]
std::vector <Undead> zombies;
zombies.push_back(Undead(&undeadTexture1, &undeadTexture2, &undeadTexture3));

What's worse is that it compiles and runs fine on my friends computer. The same code. I've tried to mimic all configurations his VS / SFML setup has to no avail. I even re-downloaded and setup SFML.

Few things:
1. SFML version : 2.5.0
2. Visual Studio 2017
3. I've not set SFML_STATIC (I don't want or need static linking)
4. All the sfml dlls are in the folder where the .exe file is supposed to be
5. I haven't faced this issue before in SFML and I've been using SFML for quite a while now.
(provided I did not have to make a vector of objects with sf::Sprite objects as members)
6. It works fine on my friends computer (same SFML version and VS)
« Last Edit: November 03, 2018, 04:14:42 am by hoenchioma »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Linking error (LNK 2019) with sf::Sprite
« Reply #1 on: November 03, 2018, 12:19:52 am »
Try a clean and full rebuild and/or delete the generated folders and object file and rebuild.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

hoenchioma

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Linking error (LNK 2019) with sf::Sprite
« Reply #2 on: November 03, 2018, 04:09:53 am »
I've also tried that. It didn't work.

 

anything