SFML help..

I need help setting up SFML, I have set it up exactly how it says on the sfml website, for code blocks and yet nothing happens, Help please!
What exactly does not happen, we cant help you with just this answer. Do you get errors? I set SFML up on VS Express with no problems. Try that.
I have 39 errors xD to many to post, but I will post some.

heres the code


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27


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



Errors:


D:\Pictures\SFML-2.0\lib\libsfml-graphics.a(d000175.o)|| first defined here|
D:\Pictures\SFML-2.0\lib\libsfml-graphics-s.a(Color.cpp.obj):Color.cpp|| multiple definition of `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'|

D:\Pictures\SFML-2.0\lib\libsfml-graphics-s.a(CircleShape.cpp.obj):CircleShape.cpp|| multiple definition of `sf::CircleShape::CircleShape(float, unsigned int)'|

D:\Pictures\SFML-2.0\lib\libsfml-graphics.a(d000039.o)|| first defined here|
You are linking against both debug and release version of the libraries.
which ones do I use?
I linked all of the .a files, not .d.a, or s.d.a just .a, and now it says


The program cant start because sfl graphics.dll2 is not installed try re-installing and continue. The code compiles now, this is just a error popup window.
Well, that error means it can't find the .dll files. So you'll need to either add them to the path or put them in the same location your .exe.
The *.a libs are dynamic release (require the DLL in the same folder as the executable).
libsfml-*-s.a are static release (no DLL required)
libsfml-*-s-d.a are static debug (no DLL)
libsfml-*-d.a are dynamic debug (require DLL)
Last edited on
Which ones do I have to include? And do I have to include debug to?
anyone?
I'd just like to point out that *.a would also refer to anything that is part of *-s.a, *-s-d.a and *-d.a.
I did all that, and now it says The procedure entry point _gxx_personality_v0 could not be located in the dynamic link libary libstdc++6.dll
Veltas wrote:
I'd just like to point out that *.a would also refer to anything that is part of *-s.a, *-s-d.a and *-d.a.
Fixed.

@Johnny
I believe you need to recompile SFML with the compiler you are using.
I know this sounds nooby, but how do you re-compile? just re-build it? I have compiled it numerous times, still the same error messagebox
By compile I mean build and run
Here is what my whole thing looks like

Settings -> Compiler -> Linker Settings:

D:\Pictures\SFML-2.0\lib\libsfml-system.a

D:\Pictures\SFML-2.0\lib\libsfml-window.a

D:\Pictures\SFML-2.0\lib\libsfml-graphics.a


Settings -> Compiler -> Search Directories -> Compiler:

D:\Pictures\SFML-2.0\include


Settings -> Compiler -> Search Directories ->

D:\Pictures\SFML-2.0\lib



Settings -> Compiler -> #defines:

SFML_STATIC
The file holding my exe has the system, graphic and window .dll files, and the debug file in my project has all the d.dll files. What did I do wrong? I hope this is enough information to help me.

You need to recompile the SFML library. All you need is the SFML source and cmake. I wrote up instructions a few months ago for another user, they're a little dumbed down but hopefully will help.

Code::Blocks SFML Installation Tutorial

Building the libs:

1. Download and install Code::Blocks
http://sourceforge.net/projects/codeblocks/files/Binaries/12.11/Windows/codeblocks-12.11mingw-setup.exe

2. Download and install cmake
http://www.cmake.org/files/v2.8/cmake-2.8.11.2-win32-x86.exe

3. Download and extract SFML source
http://www.sfml-dev.org/download/sfml/2.1/SFML-2.1-sources.zip

4. Open a command prompt and change directory to the MinGW folder in the codeblocks folder.
"C:\Program Files (x86)\CodeBlocks\MinGW" on my system. Keep this CMD window open.

5. Run mingwvars.bat from command prompt.

6. Run cmake-gui from the command prompt.

7. In cmake-gui browse to where the SFML-2.0-sources folder was extracted and set the subdirectory SFML-2.0
to where the source is. ex: C:/Users/Sean/Downloads/SFML-2.0-sources/SFML-2.0

8. Set where to build binaries, I use a build directory in the source tree.
ex: C:/Users/Sean/Downloads/SFML-2.0-sources/build
You do not need to create the directory before hand, cmake will ask if you want it to create it.

9. Click configure, cmake will ask what generator to use, select "CodeBlocks - MinGW Makefiles"
with the "Use default native compilers radio button selected. Click finish.

10. After it is done configuring click generate. This will generate makefiles for release shared (DLL) build.
Keep cmake open, we will repeat these steps for release static, debug shared, and debug static.

11. Open Code::blocks, select open existing project. Browse to the directory where files
were generated, SFML-2.0-sources/build in step 8.

12. Select SFML.cbp, make sure "all" is set as build target and click build.

13. If build was successful, and it should be, change build target to install and click build
it should install to C:\Program Files (x86)\SFML (you may need to elevate privileges to install here)

14. If you want the configurations (release static, debug shared, and debug static) go back to cmake window
change release to debug and/or uncheck build shared libs. Ideally you should have 4 configurations
built but it isn't necessary.

Setting up Code::Blocks:

15. After all the libs are built and installed, close the SFML project and select File>New>Project.
In the "New from template" window scroll down and select SFML project.

16. In the project wizard name the project and click next.

17. The wizard will ask the location of SFML, set this to where SFML was installed
("C:\Program Files (x86)\SFML" for me) and click next.

18. Check create "debug" configuration and click finish.

19. If all went well the project should be created. open the generated source file "main.cpp"
Don't run it, it wont compile it was written in SFML-1.6. Replace it with the code at the bottom
of this page http://sfml-dev.org/tutorials/2.0/start-cb.php

20. Click build, it should compile without issue. Click run, it should produce an error about the SFML
DLLs being missing. Copy them from "C:\Program Files (x86)\SFML\bin" to <project folder>\bin\Debug|Release


Tihis is my other account

source directory "D:/Downloads/SFML-1.6/SFML-1.6/src" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
Don't use 1.6, use 2.1
Topic archived. No new replies allowed.