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

Author Topic: [SOLVED] I am simply unable to run SFML on my system ?  (Read 1910 times)

0 Members and 1 Guest are viewing this topic.

ThomasAn.

  • Newbie
  • *
  • Posts: 18
    • View Profile
[SOLVED] I am simply unable to run SFML on my system ?
« on: February 06, 2013, 04:00:49 am »
1. Using Codebloks 12.11 and SFML 1.6 and the tutorial --> here, everything looks fine but when I to compile the sample.

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

I get segfaults. Windows terminates the program.

2. I downloaded SFML 2.0 went over the other tutorial --> here and then running the sample:

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}

I get numerous build errors.

3. I downloaded Cmake and SFML2.0 and then followed the instructions --> here, I get it to compile up to 94% before getting a bunch or errors.

This is simply not working for me every way I turn it.

Quote
[ 94%] Building CXX object src/SFML/Audio/CMakeFiles/sfml-audio.dir/SoundFile.cp
p.obj
D:\ThomasAn\A0_Appl\S00_Programming\SFML-2.0\src\SFML\Audio\SoundFile.cpp: In me
mber function 'bool sf::priv::SoundFile::openWrite(const string&, unsigned int,
unsigned int)':
D:\ThomasAn\A0_Appl\S00_Programming\SFML-2.0\src\SFML\Audio\SoundFile.cpp:199:48
: error: 'SF_FORMAT_OGG' was not declared in this scope
D:\ThomasAn\A0_Appl\S00_Programming\SFML-2.0\src\SFML\Audio\SoundFile.cpp:199:64
: error: 'SF_FORMAT_VORBIS' was not declared in this scope
D:\ThomasAn\A0_Appl\S00_Programming\SFML-2.0\src\SFML\Audio\SoundFile.cpp: In st
atic member function 'static int sf::priv::SoundFile::getFormatFromFilename(cons
t string&)':
D:\ThomasAn\A0_Appl\S00_Programming\SFML-2.0\src\SFML\Audio\SoundFile.cpp:303:41
: error: 'SF_FORMAT_WVE' was not declared in this scope
D:\ThomasAn\A0_Appl\S00_Programming\SFML-2.0\src\SFML\Audio\SoundFile.cpp:304:41
: error: 'SF_FORMAT_OGG' was not declared in this scope
D:\ThomasAn\A0_Appl\S00_Programming\SFML-2.0\src\SFML\Audio\SoundFile.cpp:305:41
: error: 'SF_FORMAT_MPC2K' was not declared in this scope
D:\ThomasAn\A0_Appl\S00_Programming\SFML-2.0\src\SFML\Audio\SoundFile.cpp:306:41
: error: 'SF_FORMAT_RF64' was not declared in this scope
mingw32-make[2]: *** [src/SFML/Audio/CMakeFiles/sfml-audio.dir/SoundFile.cpp.obj
] Error 1
mingw32-make[1]: *** [src/SFML/Audio/CMakeFiles/sfml-audio.dir/all] Error 2
mingw32-make: *** [all] Error 2
« Last Edit: February 07, 2013, 05:33:48 am by ThomasAn. »

io

  • Jr. Member
  • **
  • Posts: 52
  • z/OS by day, SFML by night
    • View Profile
Re: I am simply unable to run SFML on my system ?
« Reply #1 on: February 06, 2013, 05:24:52 am »
For #1 :: I'd suggest going 2.0, not 1.6 ;]

For #2 :: Code Blocks 12 uses the new GCC, have you grabbed the nightly builds from Exploiter {I think you want MinGW TDM GCC 4.7.1 32bit}?

http://en.sfml-dev.org/forums/index.php?topic=9513.0

Also, that tutorial looks like it shows only to setup release linker settings.  I (think) Code Blocks default build may be debug.  You need to add

Code: [Select]
sfml-graphics-s-d
sfml-window-s-d
sfml-system-s-d

For debug


and try

Code: [Select]
sfml-graphics-s
sfml-window-s
sfml-system-s

for release


be sure not to forget the SFML_STATIC


For #3

It looks like you are trying to compile a more complex example then your code in #2.   I'd try the basic code.  I don't use cmake, but hopefully the stuff I gave for #2 will let you just use code blocks (=
« Last Edit: February 06, 2013, 06:22:23 am by io »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: I am simply unable to run SFML on my system ?
« Reply #2 on: February 06, 2013, 08:01:27 am »
1. You must recompile SFML, none of the prebuilt packages is compatible with your version of gcc.

2. Which errors (seriously, are we supposed to guess?)?

3. It seems like CMake picked an old version of libsndfile, can you look at which one it is in cmake-gui (LIBSNDFILE_XXX or SNDFILE_XXX variables, the include path for example)?

For 2. and 3., I have the feeling that you're mixing both versions of SFML, you should completely remove one if you use the other.
Laurent Gomila - SFML developer

ThomasAn.

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: I am simply unable to run SFML on my system ?
« Reply #3 on: February 07, 2013, 05:33:16 am »
Thank you for the responses gentlemen !

I did a lot of steps and not sure which one fixed the issue. But overall I cleared/deleted everything SFML and started from a clean slate, rechecked all CodeBlocks compiler configurations for SFML linking, re-downloaded the SFML2.0 SDK, put it through the CMAKE grinder again and run mingw32-make to compile again ... and this time it compiled all the way!

Using the newly compiled dlls along with the SJLJ release candidate everything works flawlessly !
I am very happy. Finally get to draw some stuff :-)

Cheers !
« Last Edit: February 07, 2013, 05:41:07 am by ThomasAn. »