• Linker Errors SFML
    10 replies, posted
I keep trying to compile this, [cpp] #include <sfml/Graphics.hpp> #include <sfml/System.hpp> int main() { sf::RenderWindow app(sf::VideoMode(800, 600, 32), "SFML test"); while(app.IsOpened()) { sf::Event Event; while(app.GetEvent(Event)) { if(Event.Type == sf::Event::Closed) app.Close(); } app.Clear(); app.Display(); } } [/cpp] but I get this: [code]1>2.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::Display(void)" (?Display@Window@sf@@QAEXXZ) referenced in function _main 1>2.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::Close(void)" (?Close@Window@sf@@QAEXXZ) referenced in function _main 1>2.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>2.obj : error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::IsOpened(void)const " (?IsOpened@Window@sf@@QBE_NXZ) referenced in function _main 1>2.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[/code] I have the SFML library set up right. The linker input is: [code]sfml-graphics.lib sfml-system.lib[/code] Can anyone help?
What's .hpp?
What compiler are you using? [QUOTE=Klownox;16332633]What's .hpp?[/QUOTE] Just a header file extension, but used for C++ headers to disambiguate them from C headers.
Right click on the project and click Project Dependencies, tick stuff it's including. That might fix it.
[QUOTE=Klownox;16332633]What's .hpp?[/QUOTE] header plus plus. something all C++ headers should be denoted with. But... people like using .h for what reason i don't know.
Using MSVC 2008
[QUOTE=raccoon12;16333639]Using MSVC 2008[/QUOTE] Did you put the space manually or did you add both libraries to the project dependencies using the line-by-line editor box? Did you add the SFML lib directory to the list of search directories so MSVC can find them?
Does this help? [IMG]http://i31.tinypic.com/73kv0p.jpg[/IMG] [IMG]http://i28.tinypic.com/dxoehx.jpg[/IMG]
link sfml-window.lib :smugdog:
You forgot to link sfml-window.lib Add sfml-window.lib to Additional Dependencies.
Haha, that works. Thanks guys
Sorry, you need to Log In to post a reply to this thread.