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

Author Topic: Opening window code wont work  (Read 2665 times)

0 Members and 1 Guest are viewing this topic.

Patoto

  • Newbie
  • *
  • Posts: 2
    • MSN Messenger - Fanaticodenintendo@hotmail.com
    • View Profile
Opening window code wont work
« on: January 20, 2011, 02:01:44 am »
I have this code i took from the window package tutorial:


Code: [Select]
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window.hpp>


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main window
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");

    // Start main loop
    bool Running = true;
    while (Running)
    {
        App.Display();
    }

    return EXIT_SUCCESS;
}




But when i try to build it, it fails and says:

Quote
1>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall sf::Window::~Window(void)" (??1Window@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: __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 _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:\Markus\sfml-test\Debug\sfml-test.exe : fatal error LNK1120: 4 unresolved externals


I'm still learning how to use sfml, but to understand this code i need it to work. Whats going wrong with this code, its from the tutorial, so it should work, what do u guys think its happening? :lol:

tntexplosivesltd

  • Full Member
  • ***
  • Posts: 163
    • View Profile
Opening window code wont work
« Reply #1 on: January 20, 2011, 04:18:12 am »
Have you properly linked to SFML? Is it the dynamic or static libraries?
Also, please us the [code] tags.

Patoto

  • Newbie
  • *
  • Posts: 2
    • MSN Messenger - Fanaticodenintendo@hotmail.com
    • View Profile
Opening window code wont work
« Reply #2 on: January 20, 2011, 05:49:07 am »
Quote
Have you properly linked to SFML? Is it the dynamic or static libraries?
Also, please us the [code] tags.


Im sry, im rly noob to this, i googled those things u mentioned, and i found stuff about code::blocks, do those things happen while using visual c++ too?

tntexplosivesltd

  • Full Member
  • ***
  • Posts: 163
    • View Profile
Opening window code wont work
« Reply #3 on: January 20, 2011, 07:19:05 am »
Yes, the same things apply to visual C++ normally. Take a look at the SFML tutorial for setting up for Visual C++ here.
Also, another tag to add to your vocabulary:
Quote
. If you press the "Quote" button, it does it automatically.

orod

  • Newbie
  • *
  • Posts: 2
    • View Profile
Opening window code wont work
« Reply #4 on: February 09, 2011, 03:44:49 am »
Hi, I am having the same problem. I use Visual C++ EE 2010 and I linked to the static libraries.

Edit: fixed!

tntexplosivesltd

  • Full Member
  • ***
  • Posts: 163
    • View Profile
Opening window code wont work
« Reply #5 on: February 09, 2011, 03:48:08 am »
Which version of SFML are you using?

orod

  • Newbie
  • *
  • Posts: 2
    • View Profile
Opening window code wont work
« Reply #6 on: February 09, 2011, 03:59:33 am »
1.6

tntexplosivesltd

  • Full Member
  • ***
  • Posts: 163
    • View Profile
Opening window code wont work
« Reply #7 on: February 09, 2011, 04:11:10 am »
Are you sure you followed the tutorial for setting up to the letter?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Opening window code wont work
« Reply #8 on: February 09, 2011, 07:37:59 am »
You must recompile SFML.
Laurent Gomila - SFML developer

 

anything