SFML community forums
Help => General => Topic started by: Tenry on August 13, 2010, 01:55:38 am
-
I use MinGW (GCC) on Windows Vista and I don't use a real IDE. I always either type the commands on the command line or I create makefiles.
When compiling and linking a project, it might look something like this:
g++ main.cpp -o test.exe -lsfml-window -lsfml-system
In this case test.exe will always need the required DLLs of SFML (e.g. sfml-system.dll).
By searching in the internet I thought -static would be the solution:
g++ main.cpp -o test.exe -static -lsfml-window -lsfml-system
But also this result needs the DLLs.
I'm wondering how, if it is possible at all, I can link against the static sfml libraries. :(
-
the static libraries have -s at the end of their name,
so maybe:
g++ main.cpp -o test.exe -lsfml-window-s -lsfml-system-s
would work?
-
the static libraries have -s at the end of their name,
so maybe:
g++ main.cpp -o test.exe -lsfml-window-s -lsfml-system-s
would work?
That doesn't work. Compiling a little program using sf::Clock gives me the following errors:
/mingw/lib/libsfml-system-s.a(Clock.o):Clock.cpp:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
And some more undefined references.
Btw, where is it documented / "told" me about the usage with "-s", and "-d" after lib name? Does d mean "debug"?
-
That doesn't work. Compiling a little program using sf::Clock gives me the following errors:
That's a compiler problem, it's not related to SFML. Make sure that you use the right version of gcc (as described in the Code::Blocks tutorial).
Btw, where is it documented / "told" me about the usage with "-s", and "-d" after lib name?
In the "getting started" tutorial, of course...
For the Debug configuration, you can link with the debug versions of the libraries, which have the "-d" suffix ("-lsfml-system-d" in this case).
This is for the dynamic version of the libraries, the one using the DLLs. If you want to link with the static version of the libraries, add the "-s" suffix : -lsfml-system-s, or -lsfml-system-s-d for the debug version.
-
Btw, where is it documented / "told" me about the usage with "-s", and "-d" after lib name?
In the "getting started" tutorial, of course...
Oh, but I was looking at the "gcc (Linux)" tutorial and not the "Code::Blocks (MinGW)" tutorial as I am not using Code::Blocks or any other IDE, just MinGW on Windows. :roll:
Any how may I link statically on Linux? Or is it always linked statically there?
That doesn't work. Compiling a little program using sf::Clock gives me the following errors:
That's a compiler problem, it's not related to SFML. Make sure that you use the right version of gcc (as described in the Code::Blocks tutorial).
Okay, so I will read the Code::Blocks tutorial now, too and download the newer version of MinGW.
Thanks so far ^^
-
Any how may I link statically on Linux? Or is it always linked statically there?
There's no static version on Linux, static libraries are useless and are not recommended on this OS.