1
General / Re: Linking Error LNK2019 with VS2012 and SFML 2.0
« 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.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
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.
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:
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
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.
Maybe you defined SFML_STATIC but linked to the dynamic libraries?Nope
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.I actually did what's written in this tutorialWould you bet your life on that statement?
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).libSo, what can I do to fix it?
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