问题描述
我试图联系一个项目,以提高:在Ubuntu 13.04的文件系统,我在最后阶段歌厅一些奇怪的链接错误。
构建配置是通过cmake的完成:
find_package(升压组件的系统文件系统program_options必填)
include_directories($ {} Boost_INCLUDE_DIR)
link_directories($ {} Boost_LIBRARY_DIR)target_link_libraries($ {} YARS_TARGET GLEW yarsLib GL GLU过剩米DL的Xerces-C颂歌$ {} Boost_LIBRARIES)
我试着用不同的提升版本。对于1.49和1.53我有相同的行为。
在Ubuntu 12.04它的工作只是吃饭和运行的Archlinux与提升1.53我的开发机器上它编译,链接和运行就好了。
的/ usr / bin中/ G ++ -O3 CMakeFiles / yars.dir / yarsMain.o -o ../bin/yars
-L /家庭/游民/ local / lib目录-rdynamic ../lib/libyarsLib.a -lGLEW -lGL -lGLU
-lglut -lm -ldl -lxerces-C -lode -lboost_system
-lboost_filesystem -lboost_program_options
../lib/libsensorLib.a ../lib/libenvironmentLib.a ../lib/libutilLib.a ../lib/libutilFilterLib.a ../lib/libutilFormatLib.a ../lib/libutilFunctionGeneratorLib.a .. /lib/libutilIoLib.a ../lib/libutilMathLib.a ../lib/libutilDefineLib.a ../lib/libdescriptionLib.a ../lib/libfilterDescriptionLib.a ../lib/libfunctionGeneratorDescriptionLib.a ../lib /libfunctionGeneratorDescriptionUtilLib.a ../lib/libbioDescriptionLib.a ../lib/libsensorsDescriptionLib.a ../lib/libyarsDirectoriesModel.a -Wl,-rpath,/家庭/游民/ local / lib目录:
../lib/libutilIoLib.a(FileSystemOperations.o):
在功能上`FileSystemOperations :: doesDirExist(升压::文件系统::路径):
。FileSystemOperations.cpp :(文字+ 0×27):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
FileSystemOperations.cpp :(文字+ 0x3a):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
../lib/libutilIoLib.a(FileSystemOperations.o):在功能`FileSystemOperations :: doesFileExist(升压::文件系统::路径):
。FileSystemOperations.cpp :(文字+ 0x67)中:未定义引用'的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
FileSystemOperations.cpp :(文字+ 0x7a):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
../lib/libutilIoLib.a(FileSystemOperations.o):在功能`FileSystemOperations :: doesDirExist(标准::字符串*):
FileSystemOperations.cpp :(文字+ 0xca):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
../lib/libutilIoLib.a(FileSystemOperations.o):FileSystemOperations.cpp:(.text+0xdf):为`的boost ::文件系统::详细::状态(更多未定义的引用的boost ::文件系统::路径常量和放大器; ,提振::系统::错误_ code *)'跟随
../lib/libutilIoLib.a(FileSystemOperations.o):在功能`FileSystemOperations :: getFirstExistingDirContainingDir(性病::矢量<标准::字符串,性病::分配器<标准::字符串>>中的std ::字符串* ):
。FileSystemOperations.cpp :(文字+ 0x2c3):未定义的引用`的boost ::文件系统::路径:: ROOT_DIRECTORY()const的
。FileSystemOperations.cpp :(文字+ 0x35e):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
。FileSystemOperations.cpp :(文字+ 0x373):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
。FileSystemOperations.cpp :(文字+ 0x403):未定义的引用`的boost ::文件系统::路径::运营商/ =(的boost ::文件系统::路径常量和放大器;)
FileSystemOperations.cpp :(文字+ 0x43b):未定义的引用`刺激::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
。FileSystemOperations.cpp :(文字+ 0x453):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
。FileSystemOperations.cpp :(文字+ 0x50d):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
。FileSystemOperations.cpp :(文字+ 0x564):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
../lib/libutilIoLib.a(FileSystemOperations.o):在功能`FileSystemOperations :: getFirstExistingDirContainingFile(性病::矢量<标准::字符串,性病::分配器<标准::字符串>>中的std ::字符串* ):
。FileSystemOperations.cpp :(文字+ 0x7e3):未定义的引用`的boost ::文件系统::路径:: ROOT_DIRECTORY()const的
。FileSystemOperations.cpp :(文字+ 0x87e):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
。FileSystemOperations.cpp :(文字+ 0x893):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
。FileSystemOperations.cpp :(文字+ 0x923):未定义的引用`的boost ::文件系统::路径::运营商/ =(的boost ::文件系统::路径常量和放大器;)
FileSystemOperations.cpp :(文字+ 0x95b):未定义的引用`刺激::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
。FileSystemOperations.cpp :(文字+ 0x973):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
。FileSystemOperations.cpp :(文字+ 0xa2d):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
。FileSystemOperations.cpp :(文字+ 0xa84):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
../lib/libutilIoLib.a(FileSystemOperations.o):在功能`FileSystemOperations :: getFirstExistingDir(性病::矢量<标准::字符串,性病::分配器<标准::字符串>>):
。FileSystemOperations.cpp :(文字+ 0xd53):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
../lib/libutilIoLib.a(FileSystemOperations.o):FileSystemOperations.cpp:(.text+0xd68):为`的boost ::文件系统::详细::状态(更多未定义的引用的boost ::文件系统::路径常量和放大器; ,提振::系统::错误_ code *)'跟随
../lib/libutilIoLib.a(FileSystemOperations.o):在功能`FileSystemOperations :: checkValidPath(标准::字符串*,布尔,布尔,性病::字符串):
。FileSystemOperations.cpp :(文字+到0x1100):未定义的引用`的boost ::文件系统::详细:: initial_path(的boost ::系统::错误_ code *)'
。FileSystemOperations.cpp :(文字+ 0x1124):未定义的引用`的boost ::文件系统::路径::运营商/ =(的boost ::文件系统::路径常量和放大器;)
。FileSystemOperations.cpp :(文字+ 0x11e9):未定义的引用`的boost ::文件系统::路径:: ROOT_DIRECTORY()const的
。FileSystemOperations.cpp :(文字+ 0x1237):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
FileSystemOperations.cpp :(文字+ 0x130a):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
。FileSystemOperations.cpp :(文字+ 0x131f):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
FileSystemOperations.cpp :(文字+ 0x137b):未定义的引用`刺激::文件系统::详细:: system_complete(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
。FileSystemOperations.cpp :(文字+ 0x13dc):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
../lib/libutilIoLib.a(FileSystemOperations.o):在功能`FileSystemOperations :: checkValidPathFromAlternatives(标准::字符串*,标准::字符串*,性病::矢量<标准::字符串,性病::分配器< STD ::字符串>> *,布尔,性病::字符串):
。FileSystemOperations.cpp :(文字+ 0x1635):未定义的引用`的boost ::文件系统::路径:: ROOT_DIRECTORY()const的
。FileSystemOperations.cpp :(文字+ 0x1699):未定义的引用`的boost ::文件系统::路径::运营商/ =(的boost ::文件系统::路径常量和放大器;)
。FileSystemOperations.cpp :(文字+ 0x16d0):未定义的引用`的boost ::文件系统::详细:: system_complete(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
。FileSystemOperations.cpp :(文字+ 0x173f):未定义的引用`的boost ::文件系统::详细::状态(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
collect2:错误:LD返回1退出状态
只是一个建议:
1)检查您的Boost库包含所需的符号,你可以使用这样的事情:
纳米-D /usr/lib64/libboost_filesystem.so.1.52.0 | grep的细节| C ++ FILT |用grep你们的名字
2)尝试更改订单链接库,例如把-lboost_bla-BLA-BLA到命令行的末尾,并运行G ++再次,不要使用make什么命令,只是复制粘贴命令,并做实验吧。
I am trying to link a project to boost:filesystem on Ubuntu 13.04 and I am geting some weird linking errors in the last stage.
The build configuration is done via cmake:
find_package(Boost COMPONENTS system filesystem program_options REQUIRED )
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIR})
target_link_libraries(${YARS_TARGET} yarsLib GLEW GL GLU glut m dl xerces-c ode ${Boost_LIBRARIES})
I tried using a different boost version. For 1.49 and 1.53 I have the same behaviour.On Ubuntu 12.04 it does work just dine and on my development machine running Archlinux with boost 1.53 it compiles, links and runs just fine.
/usr/bin/g++ -O3 CMakeFiles/yars.dir/yarsMain.o -o ../bin/yars
-L/home/vagrant/local/lib -rdynamic ../lib/libyarsLib.a -lGLEW -lGL -lGLU
-lglut -lm -ldl -lxerces-c -lode -lboost_system
-lboost_filesystem -lboost_program_options
../lib/libsensorLib.a ../lib/libenvironmentLib.a ../lib/libutilLib.a ../lib/libutilFilterLib.a ../lib/libutilFormatLib.a ../lib/libutilFunctionGeneratorLib.a ../lib/libutilIoLib.a ../lib/libutilMathLib.a ../lib/libutilDefineLib.a ../lib/libdescriptionLib.a ../lib/libfilterDescriptionLib.a ../lib/libfunctionGeneratorDescriptionLib.a ../lib/libfunctionGeneratorDescriptionUtilLib.a ../lib/libbioDescriptionLib.a ../lib/libsensorsDescriptionLib.a ../lib/libyarsDirectoriesModel.a -Wl,-rpath,/home/vagrant/local/lib:
../lib/libutilIoLib.a(FileSystemOperations.o):
In function `FileSystemOperations::doesDirExist(boost::filesystem::path)':
FileSystemOperations.cpp:(.text+0x27): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x3a): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::doesFileExist(boost::filesystem::path)':
FileSystemOperations.cpp:(.text+0x67): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x7a): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::doesDirExist(std::string*)':
FileSystemOperations.cpp:(.text+0xca): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o):FileSystemOperations.cpp:(.text+0xdf): more undefined references to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' follow
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::getFirstExistingDirContainingDir(std::vector<std::string, std::allocator<std::string> >, std::string*)':
FileSystemOperations.cpp:(.text+0x2c3): undefined reference to `boost::filesystem::path::root_directory() const'
FileSystemOperations.cpp:(.text+0x35e): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x373): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x403): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
FileSystemOperations.cpp:(.text+0x43b): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x453): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x50d): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x564): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::getFirstExistingDirContainingFile(std::vector<std::string, std::allocator<std::string> >, std::string*)':
FileSystemOperations.cpp:(.text+0x7e3): undefined reference to `boost::filesystem::path::root_directory() const'
FileSystemOperations.cpp:(.text+0x87e): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x893): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x923): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
FileSystemOperations.cpp:(.text+0x95b): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x973): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0xa2d): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0xa84): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::getFirstExistingDir(std::vector<std::string, std::allocator<std::string> >)':
FileSystemOperations.cpp:(.text+0xd53): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o):FileSystemOperations.cpp:(.text+0xd68): more undefined references to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' follow
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::checkValidPath(std::string*, bool, bool, std::string)':
FileSystemOperations.cpp:(.text+0x1100): undefined reference to `boost::filesystem::detail::initial_path(boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x1124): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
FileSystemOperations.cpp:(.text+0x11e9): undefined reference to `boost::filesystem::path::root_directory() const'
FileSystemOperations.cpp:(.text+0x1237): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x130a): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x131f): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x137b): undefined reference to `boost::filesystem::detail::system_complete(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x13dc): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::checkValidPathFromAlternatives(std::string*, std::string*, std::vector<std::string, std::allocator<std::string> >*, bool, std::string)':
FileSystemOperations.cpp:(.text+0x1635): undefined reference to `boost::filesystem::path::root_directory() const'
FileSystemOperations.cpp:(.text+0x1699): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
FileSystemOperations.cpp:(.text+0x16d0): undefined reference to `boost::filesystem::detail::system_complete(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x173f): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
collect2: error: ld returned 1 exit status
Just a suggestion:
1)Check that your boost library contains required symbols, you can use something like this:nm -D /usr/lib64/libboost_filesystem.so.1.52.0 | grep detail | c++filt | grep your names
2)Try to change order of linking library, for example put -lboost_bla-bla-bla to the end of command line, and run this command with g++ again, not use make or something, just copy paste command and make experiments with it.
这篇关于在Ubuntu 13.04链接的boost ::文件系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!