SFML community forums

Help => General => Topic started by: RaptorIV on October 13, 2011, 09:55:47 pm

Title: Latest GitHub Snapshot - Graphics example doesn't work
Post by: RaptorIV on October 13, 2011, 09:55:47 pm
Hello all,

I recently downloaded and successfully built the latest version of SFML from github but when I try to run the example graphics program (from the tutorials) it fails with the following errors.

Code: [Select]

1>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (??1RenderWindow@sf@@UAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::Display(void)" (?Display@Window@sf@@QAEXXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::RenderTarget::Clear(class sf::Color const &)" (?Clear@RenderTarget@sf@@QAEXABVColor@2@@Z) referenced in function _main
1>main.obj : 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 _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::Close(void)" (?Close@Window@sf@@QAEXXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::GetEvent(class sf::Event &)" (?GetEvent@Window@sf@@QAE_NAAVEvent@2@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::IsOpened(void)const " (?IsOpened@Window@sf@@QBE_NXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings const &)" (??0RenderWindow@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@1@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (??0VideoMode@sf@@QAE@III@Z) referenced in function _main
1>C:\Projects\SFML\sfml-test\Debug\sfml-test.exe : fatal error LNK1120: 9 unresolved externals


Can anyone help me?

(I'm using Visual Studio 10)
Title: Latest GitHub Snapshot - Graphics example doesn't work
Post by: Nexus on October 13, 2011, 10:07:37 pm
Have you linked SFML? If so, how?
Title: Latest GitHub Snapshot - Graphics example doesn't work
Post by: Laurent on October 13, 2011, 10:09:51 pm
Are you linking to static or dynamic libraries? And, sf::Window::GetEvent doesn't exist anymore. This must be an old version.
Title: Latest GitHub Snapshot - Graphics example doesn't work
Post by: RaptorIV on October 13, 2011, 10:55:02 pm
static i beleive.

I changed the code:
Code: [Select]

1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (__imp_??1RenderWindow@sf@@UAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::ContextSettings const &)" (__imp_??0RenderWindow@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUContextSettings@1@@Z) referenced in function _main
1>main.obj : 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 _main
1>C:\Projects\SFML\sfml-test\Debug\sfml-test.exe : fatal error LNK1120: 3 unresolved externals
Title: Latest GitHub Snapshot - Graphics example doesn't work
Post by: Nexus on October 13, 2011, 11:15:12 pm
If you link statically, you must define SFML_STATIC.

Please tell us exactly what linker entries you have and which configuration (static or dynamic, release or debug). You have specified the configuration when creating the Visual Studio 2010 project with CMake.
Title: Latest GitHub Snapshot - Graphics example doesn't work
Post by: RaptorIV on October 14, 2011, 12:34:47 am
Here are the libraries i link

(http://i.imgur.com/VmwMg.png)

Release type in cmake
Title: Latest GitHub Snapshot - Graphics example doesn't work
Post by: Nexus on October 14, 2011, 12:40:44 am
You don't link a library at all. You just specify some directories, but the wrong ones -- there is the source code, not the binary .lib files.

After installing SFML (compiling the INSTALL project), choose the directory SFML/lib as library directory. Then link the libraries (i.e. enter them at Linker -> Input), where "xy" is a component like "graphics" or "system":