SFML community forums
Bindings - other languages => C => Topic started by: burton on February 02, 2010, 03:19:29 pm
-
Hi, everyone.
I was compiling my very first C code using this multimedia library, but instead of seeing an image of a muppet on the screen, my compiler gave me this error:
C:\user\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\
ld.exe: cannot find -lsfml-graphics
collect2: ld returned 1 exit status
My compiler of choice is mingw's gcc. I'm running Windows XP.
The command line:
C:\user\tests>gcc sfml.c -o sfml.exe -lsfml-graphics -lsfml-window -lsfml-system
-
It's simple. You haven't installed the SFML .lib files(might be .a) to your MinGW/lib directory.
-
Or cleaner: add -L<path/to/sfml/lib/mingw> to your linker options.
This is all explained in the "getting started" tutorial...
-
But that's the thing: I've installed them to /mingw/lib/
I put the .a files to lib, .dll files to bin and include folder to include.
edit.
gcc -c sfml.c
gcc -o sfml.exe sfml.o -Lc:\user\downloads\SFML-1.5\CSFML\lib\mingw\ -lsfml-graphics -lsfml-window -lsfml-system
gives me the same errors.
-
Ah, you're using CSFML? Then link to csfml-xxx ;)
-
Oh dear, I should have noticed. :)
Thanks!
-
If we have installed all necessary header files then after if linker error come then what does it mean?? It can possible that file has been corrupted and that's why the linker error occur??
-
What error do you get?