我试图从控制台开始调试我的应用程序。
> gdb ./Geod
然后在gdb中
(gdb) run
我得到的输出:
error while loading shared libraries: libGeo.Cored.so.1: cannot open shared object file: No such file or directory
系统配置如下:
> echo $LD_LIBRARY_PATH /home/paceholder/projects/geo/lib/debug > ls $LD_LIBRARY_PATH libGeo.Cored.so.1.0.0 libGeo.Cored.so libGeo.Cored.so.1 libGeo.Cored.so.1.0 (gdb) show solib-search-path The search path for loading non-absolute shared library symbol files is /home/paceholder/projects/geo/lib/debug.
您可以set environment在gdb中使用该命令来更改gdb用于启动要调试的程序的环境。从gdb帮助中提取:
set environment
(gdb) help set environment Set environment variable value to give the program. Arguments are VAR VALUE where VAR is variable name and VALUE is value. VALUES of environment variables are uninterpreted strings. This does not affect the program until the next "run" command.
范例LD_LIBRARY_PATH:
LD_LIBRARY_PATH
(gdb) set environment LD_LIBRARY_PATH /home/paceholder/projects/geo/lib/debug