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

Author Topic: SFML installation on CB  (Read 1290 times)

0 Members and 1 Guest are viewing this topic.

cyberstu

  • Newbie
  • *
  • Posts: 6
    • View Profile
SFML installation on CB
« on: May 25, 2012, 06:45:28 pm »
Hey all. I have recently downloaded codeblocaks and SFML. I had a load of errors to start with but that was because my project was saved as a .c file.

Now I have only 4 errors. Can I get some guidence please.

I have used the tutorial 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;
}

 

ANd here are the 4 errors I get

Quote
Untitled1.o:Untitled1.cpp|| undefined reference to `sf::Clock::Clock()'|
Untitled1.o:Untitled1.cpp|| undefined reference to `sf::Clock::GetElapsedTime() const'|
Untitled1.o:Untitled1.cpp|| undefined reference to `sf::Sleep(float)'|
Untitled1.o:Untitled1.cpp|| undefined reference to `sf::Clock::GetElapsedTime() const'|
||=== Build finished: 4 errors, 0 warnings ===|

« Last Edit: May 25, 2012, 06:49:59 pm by Laurent »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML installation on CB
« Reply #1 on: May 25, 2012, 06:50:27 pm »
You must link to sfml-system, as explained in the tutorial.
Laurent Gomila - SFML developer

cyberstu

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SFML installation on CB
« Reply #2 on: May 25, 2012, 06:57:21 pm »
I have copied the files as it states. and in the linker options included

-lsfml-system

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML installation on CB
« Reply #3 on: May 25, 2012, 06:58:59 pm »
Can you post the contents of your .cbp file?
Laurent Gomila - SFML developer

cyberstu

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SFML installation on CB
« Reply #4 on: May 25, 2012, 07:00:24 pm »
However just looked at my CB installation and noticed the following structure

C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.4.1\include

I have copied all my files to

C:\Program Files\CodeBlocks\MinGW\include

Just wondering where Im meant to copy them to

cyberstu

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SFML installation on CB
« Reply #5 on: May 25, 2012, 07:03:43 pm »
heres my .cbp file

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
        <FileVersion major="1" minor="6" />
        <Project>
                <Option title="hello" />
                <Option pch_mode="2" />
                <Option compiler="gcc" />
                <Build>
                        <Target title="Debug">
                                <Option output="bin\Debug\hello" prefix_auto="1" extension_auto="1" />
                                <Option object_output="obj\Debug\" />
                                <Option type="1" />
                                <Option compiler="gcc" />
                                <Compiler>
                                        <Add option="-g" />
                                </Compiler>
                        </Target>
                        <Target title="Release">
                                <Option output="bin\Release\hello" prefix_auto="1" extension_auto="1" />
                                <Option object_output="obj\Release\" />
                                <Option type="1" />
                                <Option compiler="gcc" />
                                <Compiler>
                                        <Add option="-O2" />
                                </Compiler>
                                <Linker>
                                        <Add option="-s" />
                                </Linker>
                        </Target>
                </Build>
                <Compiler>
                        <Add option="-Wall" />
                        <Add option="-fexceptions" />
                </Compiler>
                <Unit filename="main.cpp" />
                <Extensions>
                        <code_completion />
                        <debugger />
                </Extensions>
        </Project>
</CodeBlocks_project_file>
 
« Last Edit: May 25, 2012, 07:04:39 pm by Laurent »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML installation on CB
« Reply #6 on: May 25, 2012, 07:05:48 pm »
You're not linking to anything (look, there's no "sfml-system" in this project).

Follow the tutorial carefully and everything should be ok.
Laurent Gomila - SFML developer

cyberstu

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SFML installation on CB
« Reply #7 on: May 25, 2012, 07:14:13 pm »
I have added the

-lsfml-system

to my linker settings as told on the tutorial.

I have added it to the release part, I have tried it in the other two parts as well but no luck.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML installation on CB
« Reply #8 on: May 25, 2012, 07:17:57 pm »
I'm sorry, I can't help you more. The content of the project file doesn't reflect what you describe, and I don't know Code::Blocks enough to find out what you could have done wrong.
Laurent Gomila - SFML developer

cyberstu

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SFML installation on CB
« Reply #9 on: May 25, 2012, 07:20:15 pm »
No problems Im going to try VC++. Im used to that anyway.

 

anything