Compiling SFML with cmake

Jun 1, 2013 at 9:37pm
Hi!
Been trying to get SFML 2.0 working the last week.
I've tried many things and I am currently using SFML built with cmake for CodeBlocks::MinGW.

The first problems I had was that it didn't link properly, but after fixing that the problem I currently have has stuck through the reinstallations, recompilations, and different builds I've used.

As I've said, it compiles without any problem, but it crashes as soon as it launches. The code is taken from the SFML tutorial at the website. http://www.sfml-dev.org/tutorials/2.0/start-cb.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#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;
}


Process terminated with status -1073741819


Some guy thought it to be smart to setup a dual boot with linux but I don't think I'm all into that atm. Going really sad and mad with this since it's really holding up the programming that I really want to do atm.
Jun 1, 2013 at 10:00pm
Code work's ok.

Download from:

http://www.sfml-dev.org/download/sfml/2.0/SFML-2.0-windows-gcc-4.7-tdm-32bits.zip

Unpack and copy the SFML-2.0 folder into the codeblocks folder.

Retry the tutorial.
Last edited on Jun 1, 2013 at 10:01pm
Jun 3, 2013 at 8:57am
Still same problem, links properly, creates an executable, but when run it instantly crashes.
Jun 3, 2013 at 9:09am
most likely the problem is with your build of sfml. Im pretty sure it wasn't copiled ok, or you are using diferent settings for your project then you used for compiling your sfml.
Jun 3, 2013 at 9:56am
I did'nt use cmake, Just copied over the relevent libraries into the executable folder.
My bin, debug folder has the following files in it:

executable of your code
sfml-graphics-2.dll
sfml-system-2.dll
sfml-window-2.dll

The dll's are found in:

SFML-2.0/bin
Jun 3, 2013 at 11:13am
Yes, I have moved the dll files, linked to the correct libraries for both linker and compiler.
That's why it links and creates an executable.

But it instantly crashes, and I want to know why. And how to fix it.

I've tried numerous builds with the same 2 results, either it don't link because they are not comapatible with the compiler or they instantly crashes.
Last edited on Jun 3, 2013 at 11:14am
Jun 3, 2013 at 1:55pm
Last edited on Jun 3, 2013 at 2:06pm
Jun 3, 2013 at 3:33pm
Are you sure it instantly crashes? Or does it crash when using an SFML thing?
Jun 4, 2013 at 10:12pm
It crashes when using any type of SFML. I'll post on the SFML forum tomorrow.
tried swapping the dll, no sucess.
Topic archived. No new replies allowed.