我正在关注使用g ++进行静态和动态库链接的C++ Cookbook教程。而载入共享库的错误:我可以建立二元罚款,但是当我运行它,我得到的错误在加载共享库时出现g ++ 4.4“错误”
./hellobeatles libjohnpaul.so:无法打开共享对象文件:没有这样的文件或目录
我所使用的命令 :克++ -o hellobeatles hellobeatles.cpp -L ../johnpaul/ -L ../georgeringo/ -ljohnpaul -lgeorgeringo
程序构建并运行很好,如果我明确列出像 的路径:克++ -o hellobeatles hellobeatles.cpp ../johnpaul/libjohnpaul.so ../georgeringo/libgeorgeringo.so
我是否在第一个命令中错误地链接到libaries?还是有一些配置设置需要处理?
我正在VirtualBox中运行Ubuntu 9.10 guest虚拟机,如果这很重要,并且这里是-v 使用内置规格。 目标:x86_64-linux-gnu 配置为:../src/configure -v --with-pkgversion ='Ubuntu 4.4.1-4ubuntu9'--with-bugurl = file:/// usr/share/doc /gcc-4.4/README.Bugs --enable-languages = c,C++,fortran,objc,obj-C++ --prefix =/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir =/usr/lib --without-included-gettext --enable-threads = posix --with-gxx-include-dir =/usr/include/C++/4.4 --program -suffix = -4.4 --enable-nls --enable-clocale = gnu --enable-libstdcxx-debug --enable-objc -gc --disable-werror --with-arch-32 = i486 --with-tune = generic --enable-checking = release --build = x86_64-linux-gnu -host = x86_64-linux-gnu -target = x86_64-linux-gnu 线程模型:posix gcc版本4.4.1(Ubuntu 4.4 .1-4ubuntu9)