SFML static

I have set up SFML, and am compiling the following code;

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


Which was provided on the SFML website as a test.

I am compiling with mingw, code::blocks, the following linker options;
-lsfml-graphics
-lsfml-window
-lsfml-system

And the #define SFML_STATIC.

It compiles, and runs, so long as I have three certain dll files (each name corresponding to one of the three libraries i'm linking) in the same directory that run it from. I want to compile it so that I don't need these dlls, and everything is packed into one exe, but am unsure how.

When I try to append '-s' to any of the linker options other than -lsfml-system, the compilation fails. I think I maybe be missing some of the dependencies listed here: http://www.sfml-dev.org/tutorials/2.2/start-cb.php (about 3/4 of the way down)?
Last edited on
reading the provided page, you need to be linking sfml-xxx-s instead of sfml-xxx e.g
-lsfml-graphics-s
-lsfml-window-s
-lsfml-system-s

You may also need to list other dependencies (as shown on the page in a table)
Last edited on
I changed my linker options to;
1
2
3
4
5
6
-l sfml-graphics-s
-l sfml-window-s
-l openal32
-l jpeg
-l freetype
-l sfml-system-s

While it found all of the libraries, it still wouldn't compile.

Those are the only dependencies listed on the page that I could find in the lib directory of SFML. Do the rest need to be downloaded separately?
If you go directly to the sfml website and go to the tutorials, there are more dependencies as the latest version of sfml is 2.3 not 2.2.
Never mind, I guess I must have them somewhere, because
1
2
3
4
5
6
7
8
-l sfml-graphics-s
-l sfml-window-s
-l opengl32
-l jpeg
-l freetype
-l gdi32
-l sfml-system-s
-l winmm

worked.

I never did find glew, though.
sfml 2.3 doesn't need glew
Topic archived. No new replies allowed.