Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Linking Error  (Read 2175 times)

0 Members and 1 Guest are viewing this topic.

Hazique35

  • Newbie
  • *
  • Posts: 16
    • View Profile
Linking Error
« 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
« Last Edit: March 16, 2013, 05:21:27 pm by Hazique35 »

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Any help please
« Reply #1 on: March 16, 2013, 04:44:52 pm »
You didn't link to SFML.
Back to C++ gamedev with SFML in May 2023

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Any help please
« Reply #2 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...
Laurent Gomila - SFML developer

Hazique35

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Linkin Error
« Reply #3 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Linking Error
« Reply #4 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.
Laurent Gomila - SFML developer

Hazique35

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Linking Error
« Reply #5 on: March 16, 2013, 06:10:06 pm »
Ok, i will do this again. thanks for the answers. :)

Hazique35

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Linking Error
« Reply #6 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

Hazique35

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Linking Error
« Reply #7 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!

 

anything