我編譯我的代碼但失敗了。-L/libpath和/etc/ld.so.conf配置在gcc/g ++中編譯的libpath有什麼區別
# g++ -g test.cpp -o test -lboost_filesystem
/tmp/cc5yybJZ.o(.text+0xb0): In function `__static_initialization_and_destruction_0':
/usr/local/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
/tmp/cc5yybJZ.o(.text+0xbc):/usr/local/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
/tmp/cc5yybJZ.o(.text+0xc8):/usr/local/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
/tmp/cc5yybJZ.o(.gnu.linkonce.t._ZN5boost10filesystem9file_sizeERKNS0_4pathE+0x19): In function `boost::filesystem::file_size(boost::filesystem::path const&)':
/usr/local/include/boost/filesystem/operations.hpp:447: undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)'
collect2: error: ld returned 1 exit status
,但它是成功的,當我和編譯-L的/ usr/
g++ -g test.cpp -o test -lboost_filesystem -L/usr/local/lib
和/usr/local/lib
已經在/etc/ld.so.conf
# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/lib64
/usr/local/lib
/usr/local/mpc/lib
/usr/local/mpfc/lib
是什麼原因配置local/lib目錄?
-L/libpath和/etc/ld.so.conf配置libpath有什麼不同?