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

Author Topic: What's wrong with this code?  (Read 2313 times)

0 Members and 1 Guest are viewing this topic.

CarlosM

  • Newbie
  • *
  • Posts: 4
    • View Profile
What's wrong with this code?
« on: July 27, 2010, 10:41:39 pm »
Hey I need some help and can't compile this:

Code: [Select]

int main() {

sf::Window App(sf::VideoMode(800, 600, 32), "DEMO");

const sf::Input& Input = App.GetInput();

while (App.IsOpened())
{
sf::Event Event;
while (App.GetEvent(Event)) {

if (Event.Type == sf::Event::Closed)
App.Close();

if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();

if (Event.Type == sf:: Event::MouseMoved)
std::cout<<"X: "<<Input.GetMouseX()<<"Y: "<<Input.GetMouseY()<<std::endl;

App.Display(); }
return EXIT_SUCCESS;
}


I get a lot of linker errors: (in Spanish)
Code: [Select]

1>DEMO.obj : error LNK2019: símbolo externo "public: virtual __thiscall sf::Window::~Window(void)" (??1Window@sf@@UAE@XZ) sin resolver al que se hace referencia en la función _main
1>DEMO.obj : error LNK2019: símbolo externo "public: void __thiscall sf::Window::Display(void)" (?Display@Window@sf@@QAEXXZ) sin resolver al que se hace referencia en la función _main
1>DEMO.obj : error LNK2019: símbolo externo "public: int __thiscall sf::Input::GetMouseX(void)const " (?GetMouseX@Input@sf@@QBEHXZ) sin resolver al que se hace referencia en la función _main
1>DEMO.obj : error LNK2019: símbolo externo "public: void __thiscall sf::Window::Close(void)" (?Close@Window@sf@@QAEXXZ) sin resolver al que se hace referencia en la función _main
1>DEMO.obj : error LNK2019: símbolo externo "public: bool __thiscall sf::Window::GetEvent(class sf::Event &)" (?GetEvent@Window@sf@@QAE_NAAVEvent@2@@Z) sin resolver al que se hace referencia en la función _main
1>DEMO.obj : error LNK2019: símbolo externo "public: bool __thiscall sf::Window::IsOpened(void)const " (?IsOpened@Window@sf@@QBE_NXZ) sin resolver al que se hace referencia en la función _main
1>DEMO.obj : error LNK2019: símbolo externo "public: class sf::Input const & __thiscall sf::Window::GetInput(void)const " (?GetInput@Window@sf@@QBEABVInput@2@XZ) sin resolver al que se hace referencia en la función _main
1>DEMO.obj : error LNK2019: símbolo externo "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) sin resolver al que se hace referencia en la función _main
1>DEMO.obj : error LNK2019: símbolo externo "public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (??0VideoMode@sf@@QAE@III@Z) sin resolver al que se hace referencia en la función _main
1>C:\Documents and Settings\Carlos\Mis documentos\SFML\MOUSE_DEMO\Debug\MOUSE_DEMO.exe : fatal error LNK1120: 9 externos sin resolver

I use Visual C++ 2008
If anyone can help, that would be greatly appreciated

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
What's wrong with this code?
« Reply #1 on: July 27, 2010, 10:44:37 pm »
You have to link to sfml-window.
Laurent Gomila - SFML developer

CarlosM

  • Newbie
  • *
  • Posts: 4
    • View Profile
What's wrong with this code?
« Reply #2 on: July 27, 2010, 10:47:46 pm »
Thanks man.

 

anything