SFML community forums

Help => General => Topic started by: Hazique35 on March 16, 2013, 04:38:24 pm

Title: Linking Error
Post by: Hazique35 on March 16, 2013, 04:38:24 pm
Ive only started SFML for a little while, and ive been doing C++ for a little while. Ive been trying to get this silly progrm to work! I cant get the window to open.  I basically just retyped the source code:

#include <SFML\Window.hpp>

int main()
{
        sf::Window App(sf::VideoMode(800, 600, 32), "SFML test");

        bool Running = true;

        while (Running)
        {
                App.Display();
        }
        return EXIT_SUCCESS;
}

Judging by the errors, I didnt configure something correctly:

1>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall sf::Window::~Window(void)" (??1Window@sf@@UAE@XZ) referenced in function "int __cdecl t_main(void)" (?t_main@@YAHXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::Display(void)" (?Display@Window@sf@@QAEXXZ) referenced in function "int __cdecl t_main(void)" (?t_main@@YAHXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::Window::Window(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings const &)" (??0Window@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@1@@Z) referenced in function "int __cdecl t_main(void)" (?t_main@@YAHXZ)
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 "int __cdecl t_main(void)" (?t_main@@YAHXZ)
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>c:\users\haziqu\documents\visual studio 2010\Projects\SFML\Debug\SFML.exe : fatal error LNK1120: 5 unresolved externals

I would really appreciate it if someone just identified something Im doing wrong. Im using VS 2010.

Thanks
Title: Re: Any help please
Post by: FRex on March 16, 2013, 04:44:52 pm
You didn't link to SFML.
Title: Re: Any help please
Post by: Laurent on March 16, 2013, 05:02:53 pm
More specifically, to sfml-window and sfml-main.

And can you please edit your message to give it a more relevant title? Everyone here needs help...
Title: Re: Linkin Error
Post by: Hazique35 on March 16, 2013, 05:20:54 pm
I did the whole SFML set up, I watched a youtube video and made sure everything was correct. What do you mean by SFML main?
Title: Re: Linking Error
Post by: Laurent on March 16, 2013, 05:54:29 pm
The tutorial shows how to link to the sfml-system library. You must do the same with sfml-main and sfml-window.
Title: Re: Linking Error
Post by: Hazique35 on March 16, 2013, 06:10:06 pm
Ok, i will do this again. thanks for the answers. :)
Title: Re: Linking Error
Post by: Hazique35 on March 16, 2013, 07:27:04 pm
Ok, I downloaded the files, except i downloaded version 2.0. Everything works except this one error:

1>LINK : fatal error LNK1104: cannot open file 'sfml-graphics.lib'

this is the only file that cannot be found. I think it might have to do with the '-s' and '-s-d' suffixes and that 'STATIC_MAIN' thingy that can be put in the preprocessor section. The thing that is confusing me is the Debug and Release stuff, I dont know which files need which suffix. Or whether or not they even need one. This is the only problem left, and it is really puzzling me.
Any Ideas?

Thanks
Title: Re: Linking Error
Post by: Hazique35 on March 16, 2013, 09:50:12 pm
oh, sorry! You guys dont need to worry anymore, I know what to do. Thanks for the replies again!