Build log shows the following:
Executing: xterm -T test -e /usr/bin/cb_console_runner LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. /home/.../bin/Debug/test (in /home/.../test/.)
when I executed it via command line, it worked fine!
From
Settings->Compiler...->Search directores
i've added SFML's include and lib directories for compiler & linker respectively.
In project Build Options..->Linker settings->Other linker options:
-lsfml-system
-lsfml-window
-lsfml-graphics
Sure,
-------------- Clean: Debug in test (compiler: GNU GCC Compiler)---------------
Cleaned "test - Debug"
-------------- Build: Debug in test (compiler: GNU GCC Compiler)---------------
g++ -Wall -g -std=c++11 -I/home/ejamsa/SFML-2.1/include -c /home/ejamsa/Projects/sfml/test/main.cpp -o obj/Debug/main.o
g++ -L/home/ejamsa/SFML-2.1/lib -o bin/Debug/test obj/Debug/main.o -lsfml-system -lsfml-window -lsfml-graphics ../../../SFML-2.1/lib/libsfml-system.so
Output file is bin/Debug/test with size 100.08 KB
Strange is that it complains about libsfml-system.so.2 (which is a symlink) not about libsfml-system.so (which is also symlink). The real library is libsfml-system.so.2.1!
Sorry, the correct output is
-------------- Clean: Debug in test (compiler: GNU GCC Compiler)---------------
Cleaned "test - Debug"
-------------- Build: Debug in test (compiler: GNU GCC Compiler)---------------
g++ -Wall -g -std=c++11 -I/home/eero/SFML-2.1/include -c /home/eero/Projects/sfml/test/main.cpp -o obj/Debug/main.o
g++ -L/home/eero/SFML-2.1/lib -o bin/Debug/test obj/Debug/main.o -lsfml-system -lsfml-window -lsfml-graphics
Output file is bin/Debug/test with size 100.08 KB
Process terminated with status 0 (0 minute(s), 1 second(s))
0 error(s), 0 warning(s) (0 minute(s), 1 second(s))
The
../../../SFML-2.1/lib/libsfml-system.so
from the previous post was my "hack" where I tried to add libsfml-system.so by selecting it in Settings->Compiler...->Linker settings->Link libraries:!
No, they work the same way regardless the project type!
When I run "complex one", I get
-------------- Run: Debug in test (compiler: GNU GCC Compiler)---------------
Checking for existence: /home/ejamsa/Projects/sfml/test/bin/Debug/test
Executing: xterm -T test -e /usr/bin/cb_console_runner LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. /home/ejamsa/Projects/sfml/test/bin/Debug/test (in /home/ejamsa/Projects/sfml/test/.)
Process terminated with status 0 (0 minute(s), 2 second(s))
Is it possible to print out LD_LIBRARY_PATH before it runs test program? It must be something to do with the LD_LIBRARY_PATH variable. If I open xterm and type
it displays /home/ejamsa/SFML-2.1/lib, which is correct directory
See how it should look:
-------------- Build: Debug in stepping (compiler: GNU GCC Compiler)---------------
g++ -Wall -fexceptions -g -Werror=return-type -Woverloaded-virtual -c /home/obfuscated/projects/tests/_cb_dbg/stepping/main.cpp -o .obj/debug/main.o
g++ -Wall -fexceptions -g -Werror=return-type -Woverloaded-virtual -c /home/obfuscated/projects/tests/_cb_dbg/stepping/test.cpp -o .obj/debug/test.o
g++ -Wall -fexceptions -g -Werror=return-type -Woverloaded-virtual -c /home/obfuscated/projects/tests/_cb_dbg/stepping/test_no_debug.cpp -o .obj/debug/test_no_debug.o
g++ -L/home/obfuscated/ -o bin/debug/stepping .obj/debug/main.o .obj/debug/test.o .obj/debug/test_no_debug.o
Output file is bin/debug/stepping with size 29.06 KB
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 4 warning(s) (0 minute(s), 0 second(s))
-------------- Run: Debug in stepping (compiler: GNU GCC Compiler)---------------
Checking for existence: /home/obfuscated/projects/tests/_cb_dbg/stepping/bin/debug/stepping
Executing: xterm -T stepping -g 200x80 -bg gray -fg black -e /usr/bin/cb_console_runner LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.:/home/obfuscated/ /home/obfuscated/projects/tests/_cb_dbg/stepping/bin/debug/stepping (in /home/obfuscated/projects/tests/_cb_dbg/stepping/.)
I've added /home/obfuscated to the linker's search paths and as you can see it is set in LD_LIBRARY_PATH as it should.
I don't know why it doesn't work for you.
I got it to work finally!
It works if I right click project->Build options...->Search directories->Linker and add the directory there.
If I go Settings->Compiler...->Search directories->Linker and add linker search directory, then running the executable from C::B won't work as SFML's lib directory won't be added to LD_LIBRARY_PATH!
What i don't understand is that why such difference between global and project settings?
Also LD_LIBRARY_PATH should contain SFML's lib directory regardless of settings in C::B because I've added it to ~/.bashrc! This is the reason why i don't understand why
Executing: xterm -T test -e /usr/bin/cb_console_runner LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. /home/ejamsa/Projects/sfml/test/bin/Debug/test (in /home/ejamsa/Projects/sfml/test/.)
doesn't work as this command only appends current path to LD_LIBRARY_PATH
Thank you, oBFusCATed, for helping me to get it work!
If anyone knows answers to questions above, can you please shed some light on that?