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

Author Topic: Can't get SFML and codeblocks to work  (Read 1821 times)

0 Members and 1 Guest are viewing this topic.

iceman1992

  • Newbie
  • *
  • Posts: 6
    • View Profile
Can't get SFML and codeblocks to work
« on: June 27, 2012, 04:58:47 am »
I followed the installation instructions.
Downloaded SFML 1.6 Full SDK, copied the include and lib folders to codeblocks' mingw include and lib folders.
And then I tried compiling the example code
#include <SFML/System.hpp>
#include <iostream>

int main()
{
    sf::Clock Clock;
    while (Clock.GetElapsedTime() < 5.f)
    {
        std::cout << Clock.GetElapsedTime() << std::endl;
        sf::Sleep(0.5f);
    }

    return 0;
}
Then I get errors :
Line 6   undefined reference to 'sf::Clock::Clock()'
Line 9   undefined reference to 'sf::Clock::GetElapsedTime() const'
Line 10 undefined reference to 'sf::Sleep(float)'
Line 7   undefined reference to 'sf::Clock::GetElapsedTime() const'

What did I do wrong?
My OS is Win7 Ultimate 64 bit, with CodeBlocks 10.05

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Can't get SFML and codeblocks to work
« Reply #1 on: June 27, 2012, 07:58:37 am »
You didn't link to sfml-system. Read the tutorial again, it's explained.
Laurent Gomila - SFML developer

iceman1992

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Can't get SFML and codeblocks to work
« Reply #2 on: June 28, 2012, 11:14:04 am »
Oh I see. Sorry about that, I didn't read the part after the code.
Now it compiles OK, but when I run it, it says libgcc_s_dw2-1.dll is missing.
It previously said sfml-system.dll is missing but I copied the file to the directory containing the executable.
« Last Edit: June 28, 2012, 11:32:30 am by iceman1992 »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Can't get SFML and codeblocks to work
« Reply #3 on: June 28, 2012, 01:14:33 pm »
The missing DLL is in your MinGW/bin directory.
Laurent Gomila - SFML developer

iceman1992

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Can't get SFML and codeblocks to work
« Reply #4 on: June 28, 2012, 04:43:25 pm »
Okay I got it running. Thank you

 

anything