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

Author Topic: Linking Error LNK2019 with VS2012 and SFML 2.0  (Read 12705 times)

0 Members and 1 Guest are viewing this topic.

Randl

  • Newbie
  • *
  • Posts: 7
    • View Profile
Linking Error LNK2019 with VS2012 and SFML 2.0
« on: December 22, 2012, 08:05:26 pm »
I've downloaded SFML 2.0 from GitHub, configured with CMake and built with nmake. Created a project based on this tutorial. While compiling project I get errors:
Quote
error   1   error LNK2019: unresolved external symbol "public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (??0VideoMode@sf@@QAE@III@Z) referenced in function "public: static void __cdecl Game::Start(void)" (?Start@Game@@SAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   2   error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::create(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,struct sf::ContextSettings const &)" (?create@Window@sf@@QAEXVVideoMode@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IABUContextSettings@2@@Z) referenced in function "public: static void __cdecl Game::Start(void)" (?Start@Game@@SAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   3   error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::close(void)" (?close@Window@sf@@QAEXXZ) referenced in function "public: static void __cdecl Game::Start(void)" (?Start@Game@@SAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   4   error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::pollEvent(class sf::Event &)" (?pollEvent@Window@sf@@QAE_NAAVEvent@2@@Z) referenced in function "private: static void __cdecl Game::GameLoop(void)" (?GameLoop@Game@@CAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   5   error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::display(void)" (?display@Window@sf@@QAEXXZ) referenced in function "private: static void __cdecl Game::GameLoop(void)" (?GameLoop@Game@@CAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   6   error LNK2019: unresolved external symbol "public: __thiscall sf::Color::Color(unsigned char,unsigned char,unsigned char,unsigned char)" (??0Color@sf@@QAE@EEEE@Z) referenced in function "private: static void __cdecl Game::GameLoop(void)" (?GameLoop@Game@@CAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   7   error LNK2019: unresolved external symbol "public: void __thiscall sf::RenderTarget::clear(class sf::Color const &)" (?clear@RenderTarget@sf@@QAEXABVColor@2@@Z) referenced in function "private: static void __cdecl Game::GameLoop(void)" (?GameLoop@Game@@CAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   8   error LNK2019: unresolved external symbol "public: __thiscall sf::RenderWindow::RenderWindow(void)" (??0RenderWindow@sf@@QAE@XZ) referenced in function "void __cdecl `dynamic initializer for 'private: static class sf::RenderWindow Game::_mainWindow''(void)" (??__E?_mainWindow@Game@@0VRenderWindow@sf@@A@@YAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   9   error LNK2019: unresolved external symbol "public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (??1RenderWindow@sf@@UAE@XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'private: static class sf::RenderWindow Game::_mainWindow''(void)" (??__F?_mainWindow@Game@@0VRenderWindow@sf@@A@@YAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   10   error LNK1120: unresolved externals : 9   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Debug\Pang.exe   Pang

I'm using SFML dynamic. I added SFML both to Additional Include Directories and Additional Library Directories. I added *.lib files to Additional Dependencies. I'm on Win8 64-bit.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Linking Error LNK2019 with VS2012 and SFML 2.0
« Reply #1 on: December 22, 2012, 08:11:17 pm »
Created a project based on this tutorial.
Please follow the official tutorials!

I'm using SFML dynamic. I added SFML both to Additional Include Directories and Additional Library Directories. I added *.lib files to Additional Dependencies.
I hope that doesn't mean that you actually wrote *.lib into the Additional Dependencies field, or did you? ???
From the linker error it seems like you don't link against sfml-window(-d).lib
« Last Edit: December 28, 2012, 09:07:30 am by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Randl

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Linking Error LNK2019 with VS2012 and SFML 2.0
« Reply #2 on: December 22, 2012, 08:48:11 pm »
Please follow the official tutorials!
I actually did what's written in this tutorial
I hope that doesn't mean that you actually wrote *.lib into the Additional Dependencies field, or did you? ???
Of course, no  ;)
From the linker error it seems like you don't like against sfml-window(-d).lib
So, what can I do to fix it?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Linking Error LNK2019 with VS2012 and SFML 2.0
« Reply #3 on: December 22, 2012, 08:52:56 pm »
I actually did what's written in this tutorial
Would you bet your life on that statement? :P

So, what can I do to fix it?
Well you have to add them to the project settings as described in the official tutorial. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Randl

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Linking Error LNK2019 with VS2012 and SFML 2.0
« Reply #4 on: December 22, 2012, 09:26:44 pm »
I actually did what's written in this tutorial
Would you bet your life on that statement? :P
I did it one more time, folowing official tutorial step by step and now i'm pretty sure I've done everything just as written in it. Nevertheless, it didn't help. :-[

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Linking Error LNK2019 with VS2012 and SFML 2.0
« Reply #5 on: December 22, 2012, 10:45:40 pm »
Maybe you defined SFML_STATIC but linked to the dynamic libraries?
Laurent Gomila - SFML developer

Randl

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Linking Error LNK2019 with VS2012 and SFML 2.0
« Reply #6 on: December 23, 2012, 12:20:21 am »
Maybe you defined SFML_STATIC but linked to the dynamic libraries?
Nope

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Linking Error LNK2019 with VS2012 and SFML 2.0
« Reply #7 on: December 23, 2012, 09:26:37 am »
Nope what? Do you link statically or dynamically?
Laurent Gomila - SFML developer

Randl

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Linking Error LNK2019 with VS2012 and SFML 2.0
« Reply #8 on: December 23, 2012, 03:02:50 pm »
Nope what? Do you link statically or dynamically?
I didn't define SFML_STATIC. As I understood,  I don't need to do anything to link dynamically. At least, there was written only what I need to do in addition to link statically in tutorial.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Linking Error LNK2019 with VS2012 and SFML 2.0
« Reply #9 on: December 23, 2012, 03:21:02 pm »
Quote
I didn't define SFML_STATIC
I think you do. Otherwise the unresolved symbols would have the "__imp_" prefix.
Laurent Gomila - SFML developer

Randl

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Linking Error LNK2019 with VS2012 and SFML 2.0
« Reply #10 on: December 23, 2012, 08:01:54 pm »
I think you do. Otherwise the unresolved symbols would have the "__imp_" prefix.
I just checked. SFML_STATIC isn't defined. And the error is really different:
Quote
error   1   error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z) referenced in function "public: static void __cdecl Game::Start(void)" (?Start@Game@@SAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   2   error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::create(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,struct sf::ContextSettings const &)" (__imp_?create@Window@sf@@QAEXVVideoMode@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IABUContextSettings@2@@Z) referenced in function "public: static void __cdecl Game::Start(void)" (?Start@Game@@SAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   3   error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::close(void)" (__imp_?close@Window@sf@@QAEXXZ) referenced in function "public: static void __cdecl Game::Start(void)" (?Start@Game@@SAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   4   error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::pollEvent(class sf::Event &)" (__imp_?pollEvent@Window@sf@@QAE_NAAVEvent@2@@Z) referenced in function "private: static void __cdecl Game::GameLoop(void)" (?GameLoop@Game@@CAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   5   error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::display(void)" (__imp_?display@Window@sf@@QAEXXZ) referenced in function "private: static void __cdecl Game::GameLoop(void)" (?GameLoop@Game@@CAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   6   error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Color::Color(unsigned char,unsigned char,unsigned char,unsigned char)" (__imp_??0Color@sf@@QAE@EEEE@Z) referenced in function "private: static void __cdecl Game::GameLoop(void)" (?GameLoop@Game@@CAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   7   error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::RenderTarget::clear(class sf::Color const &)" (__imp_?clear@RenderTarget@sf@@QAEXABVColor@2@@Z) referenced in function "private: static void __cdecl Game::GameLoop(void)" (?GameLoop@Game@@CAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   8   error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::RenderWindow::RenderWindow(void)" (__imp_??0RenderWindow@sf@@QAE@XZ) referenced in function "void __cdecl `dynamic initializer for 'private: static class sf::RenderWindow Game::_mainWindow''(void)" (??__E?_mainWindow@Game@@0VRenderWindow@sf@@A@@YAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   9   error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (__imp_??1RenderWindow@sf@@UAE@XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'private: static class sf::RenderWindow Game::_mainWindow''(void)" (??__F?_mainWindow@Game@@0VRenderWindow@sf@@A@@YAXXZ)   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Pang\Game.obj   Pang
error   10   error LNK1120: unresolved externals: 9   C:\Users\Evgenii\documents\visual studio 2012\Projects\Pang\Debug\Pang.exe   1   1   Pang

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Linking Error LNK2019 with VS2012 and SFML 2.0
« Reply #11 on: December 23, 2012, 08:38:31 pm »
???

Why is it different now?
Laurent Gomila - SFML developer

Randl

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Linking Error LNK2019 with VS2012 and SFML 2.0
« Reply #12 on: December 23, 2012, 08:57:00 pm »
Why is it different now?
While trying to fix the error, I tried to define SFML_STATIC. Possibly I posted the error here, when it was defined.

massive_potato

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Linking Error LNK2019 with VS2012 and SFML 2.0
« Reply #13 on: December 28, 2012, 05:52:04 am »
Just throwing out a suggestion - did you copy the .dll files to your solution folder? That could be the source of your errors.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: Linking Error LNK2019 with VS2012 and SFML 2.0
« Reply #14 on: December 28, 2012, 09:11:48 am »
I'm still saying you didn't add the libs to the settings, does it look like this?

Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything