2
votes

I'm pretty new to C++ and I was setting up a project with SFML, which was working fine, I have no code issues according to Visual Studio, but when I debug I get these error messages:

Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::String(char const *,class std::locale const &)" (_imp??0String@sf@@QAE@PBDABVlocale@std@@@Z) referenced in function "public: static void __cdecl Game::Start(void)" (?Start@Game@@SAXXZ) c:\Users\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

Error 2 error LNK2019: unresolved external symbol "__declspec(dllimport) public: _thiscall sf::String::~String(void)" (_imp_??1String@sf@@QAE@XZ) referenced in function "public: static void __cdecl Game::Start(void)" (?Start@Game@@SAXXZ) c:\Users\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

Error 3 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\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

Error 4 error LNK2019: unresolved external symbol "__declspec(dllimport) public: void _thiscall sf::Window::create(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (_imp_?create@Window@sf@@QAEXVVideoMode@2@ABVString@2@IABUContextSettings@2@@Z) referenced in function "public: static void __cdecl Game::Start(void)" (?Start@Game@@SAXXZ) c:\Users\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

Error 5 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\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

Error 6 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\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

Error 7 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\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

Error 8 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\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

Error 9 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\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

Error 10 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\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

Error 11 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\Harley\cppprojects\Pong\PongSFML\PongSFML\Game.obj PongSFML

Error 12 error LNK1120: 11 unresolved externals c:\Users\Harley\cppprojects\Pong\PongSFML\Debug\PongSFML.exe 1 1 PongSFML

I've already done quite a bit of research to try to fix this, but no suggestions worked or changed anything at all. I checked through my additional dependencies and I didn't make any spelling errors:

sfml-main-d.lib;sfml-audio-d.lib;sfml-system-d.lib;sfml-window-d.lib;sfml-graphics-d.lib;

My release dependencies:

sfml-system.lib;sfml-window.lib;sfml-graphics.lib;sfml-audio.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;

Once again, I'm new to C++ so I may be doing something incredibly stupid. I don't think my source code has anything to do with it, however someone suggested that I add

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

above my main method, so I did.

Does anyone know what I'm doing wrong?

Thanks

1

1 Answers

1
votes

I can't add a comment, but can you set the linker to /VERBOSE so you can see what libraries the linker has found and whether the .lib's you specified are actually getting linked in?

The setting is under C++ > Linker > Progress I think

EDIT: http://s30.postimg.org/485cmfnk1/temp.png <-- Here