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

Author Topic: Problem with compiling the example code  (Read 2831 times)

0 Members and 1 Guest are viewing this topic.

SFML rulez

  • Newbie
  • *
  • Posts: 4
    • View Profile
Problem with compiling the example code
« on: April 10, 2009, 03:08:47 pm »
If I want to compile the Example Code:

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;
}


the compiler displays this error messages:

Code: [Select]
undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'|
undefined reference to `sf::Window::Window(sf::VideoMode, std::string const&, unsigned long, sf::WindowSettings const&)'|
undefined reference to `sf::Window::Display()'|
undefined reference to `sf::Window::~Window()'|
undefined reference to `sf::Window::~Window()'|
||=== Build finished: 5 errors, 0 warnings ===|


In Codeblocks under 'Other Linker Options' i have inserted:

Code: [Select]
-lsfml-network
-lsfml-network-d


Under Link Libraries i have inserted:

Code: [Select]
C:\Programme\CodeBlocks\MinGW\lib\libws2_32.a

and under search directories I have inserted:

Code: [Select]
C:\Programme\CodeBlocks\SFML\SFML-1.4\include

Sorry if my english isnĀ“t very good.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problem with compiling the example code
« Reply #1 on: April 10, 2009, 03:36:24 pm »
Try linking to sfml-window instead of sfml-network. And try not using both debug and release versions, one is enough, otherwise you'll confuse the linker ;)
Laurent Gomila - SFML developer

SFML rulez

  • Newbie
  • *
  • Posts: 4
    • View Profile
Problem with compiling the example code
« Reply #2 on: April 10, 2009, 04:03:08 pm »
Thank you, it works!  :)

 

anything