User forums > Using Code::Blocks
[SOLVED]"Cannot open shared object file ..." when running executable from C::B
ejamsa:
Hey guys,
I'm building a SFML application with C::B and encountered a problem which doesn't let me run the app within C::B.
When i press "Run" or "Build and run" I get error: "error while loading shared libraries: libsfml-system.so.2: cannot open shared object file: No such file or directory"
Project compiles and links fine. It seems to be dynamic linking issue. I've set LD_LIBRARY_PATH to point SFML libraries, so using command line to run my app, everything works fine.
Any thoughts on that?
PS! I'm using C::B 13.12 on Debian Wheezy. I don't think the C::B version matters much, because the same happened on 12.11 as well.
oBFusCATed:
If you look at the build log you'll what is the value of the LD_LIBRARY_PATH variable that C::B passes to your application. Is it correct?
ejamsa:
Build log shows the following:
--- Code: ---Executing: xterm -T test -e /usr/bin/cb_console_runner LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. /home/.../bin/Debug/test (in /home/.../test/.)
--- End code ---
when I executed it via command line, it worked fine!
oBFusCATed:
What path have you set in the linker options?
Exact one or one produced by a wrapper script like "pkg-config or sfml-config"?
I guess it is the latter.
Hint: C::B will append all linker search paths set in the project options. So if you add the path to the .so manually it should work.
ejamsa:
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:
--- Code: ----lsfml-system
-lsfml-window
-lsfml-graphics
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version