SFML community forums

Help => General => Topic started by: micky on October 21, 2011, 02:16:57 pm

Title: Installing SFML on Eclipse CDT/Linux
Post by: micky on October 21, 2011, 02:16:57 pm
Hey guys. I am trying to write some C++ using Eclipse CDT and SFML on Linux.

When pointing the project's GCC C++ Linker to sfml-system (named libsfml-system on the 1.6 release), I get the following output when I try to build a HelloWorld project:

Code: [Select]
**** Build of configuration Debug for project SFMLHelloWorld ****

make all
Building target: SFMLHelloWorld
Invoking: GCC C++ Linker
g++ -L"/home/u09/<omit>/Stage 3/SFML-1.6/lib" -o"SFMLHelloWorld"  ./src/SFMLHelloWorld.o   -llibsfml-system.d
/usr/bin/ld: cannot find -llibsfml-system.d
collect2: ld returned 1 exit status
make: *** [SFMLHelloWorld] Error 1


It seems that the linker is looking in /usr/bin/ for the library even though I have specified another library search path to be checked. I'm on university computers and don't have permission to place files in /usr/ which is why I chose a non-standard directory for SFML.

Is there any way to remedy this?
Title: Installing SFML on Eclipse CDT/Linux
Post by: Laurent on October 21, 2011, 02:23:36 pm
-llibsfml-system.d ???

That should be -lsfml-system
Title: Installing SFML on Eclipse CDT/Linux
Post by: micky on October 21, 2011, 03:15:45 pm
Quote from: "Laurent"
-llibsfml-system.d ???

That should be -lsfml-system


Simply trying to match the file names, if I change it I still get:


Code: [Select]
**** Build of configuration Debug for project SFMLHelloWorld ****

make all
Building target: SFMLHelloWorld
Invoking: GCC C++ Linker
g++ -L"/home/u09/a7046028/Stage 3/SFML-1.6/lib" -o"SFMLHelloWorld"  ./src/SFMLHelloWorld.o   -lsfml-system
/usr/bin/ld: cannot find -lsfml-system
collect2: ld returned 1 exit status
make: *** [SFMLHelloWorld] Error 1
Title: Installing SFML on Eclipse CDT/Linux
Post by: Laurent on October 21, 2011, 03:22:22 pm
What's the exact filename of the library?

Basically, to link libxyz.a, the option is -lxyz. The "lib" prefix and the extension are automatically handled by the linker.
Title: Installing SFML on Eclipse CDT/Linux
Post by: micky on October 21, 2011, 03:23:26 pm
libsfml-system.so.1.6 is the filename,  andthe rest are named the same way. This is how I downloaded them.
Title: Installing SFML on Eclipse CDT/Linux
Post by: Laurent on October 21, 2011, 03:26:25 pm
Quote
libsfml-system.so.1.6 is the filename, andthe rest are named the same way. This is how I downloaded them.

You should install SFML (make install) so that you get a symbolic link "libsfml-system.so" that points to "libsfml-system.so.1.6", and after that -lsfml-system should work.

Or you can directly link it as "libsfml-system.so.1.6" (no -l if you give the full filename).
Title: Installing SFML on Eclipse CDT/Linux
Post by: micky on October 21, 2011, 03:37:49 pm
Ok, apparently there's an issue where they don't link after installing on these machines, and since I'm using Eclipse I don't think it's possible to directly link them.

I guess I will try a different system.