我正在關注使用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)