相关疑难解决方法(0)

usr/bin/ld:找不到-l <nameOfTheLibrary>

我正在尝试编译我的程序,它返回此错误:

usr/bin/ld: cannot find -l<nameOfTheLibrary>
Run Code Online (Sandbox Code Playgroud)

在我的makefile中,我使用命令g++并链接到我的库,这是指向位于其他目录中的库的符号链接.

是否可以选择添加以使其正常工作?

c++ linux g++

401
推荐指数
8
解决办法
86万
查看次数

编译时对boost :: system :: system_category()的未定义引用

我正在尝试在Ubuntu 11.10上编译一个使用Boost库的程序.我安装了Ubuntu Repository中的1.46-dev Boost库,但编译程序时出错.

undefined reference to boost::system::system_category()

我做错了什么?

c++ boost

102
推荐指数
6
解决办法
13万
查看次数

对'boost :: system :: generic_category()'的未定义引用?

似乎我无法看到明显的.我想为我的项目使用一些Boost库功能,并且知道我突然得到了这些好错误:

链接CXX可执行文件ATFOR CMakeFiles/ATFOR.dir/stdafx.cc.o:在函数__static_initialization_and_destruction_0(int, int)': stdafx.cc:(.text+0x3c): undefined reference toboost :: system :: generic_category()'stdafx.cc :(.text + 0x48 )中:对boost::system::generic_category()' stdafx.cc:(.text+0x54): undefined reference toboost :: system :: system_category的未定义引用( )'CMakeFiles/ATFOR.dir/Main.cc.o:在函数__static_initialization_and_destruction_0(int, int)': Main.cc:(.text+0x29d): undefined reference toboost :: system :: generic_category()'Main.cc :(.text + 0x2a9):未定义的引用boost::system::generic_category()' Main.cc:(.text+0x2b5): undefined reference toboost :: system :: system_category()' collect2:错误:ld返回1退出状态

在这里你可以找到我的CMakeLists.txt,标题和主要内容:http ://pastie.org/8231509
正如你所看到的,我尝试了很多与CMakeLists一起玩,我很确定我拥有项目所需的所有标题.无论如何,我之前从未遇到过这样的错误,我真的很感激任何有关错误的建议/解决方案,因为我现在还没有任何想法.Thx提前.

c++ boost cmake

7
推荐指数
3
解决办法
1万
查看次数

G ++找不到boost库

我不擅长命令行编译.我的问题是无法编译简单的项目,这取决于Boost.以下是我尝试的日志:

$ g++ -Wall test.cpp -o main
/tmp/ccCTvBYE.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x6b): undefined reference to `boost::system::generic_category()'
test.cpp:(.text+0x77): undefined reference to `boost::system::generic_category()'
test.cpp:(.text+0x83): undefined reference to `boost::system::system_category()'
/tmp/ccCTvBYE.o: In function `boost::asio::error::get_system_category()':
test.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[_ZN5boost4asio5error19get_system_categoryEv]+0x5): undefined reference to `boost::system::system_category()'
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

所以,还有我发现添加指令-lboost_system-lboost_system-mt.我得到以下内容:

$ g++ -lboost_system -Wall test.cpp -o main                                                                                                                    
/usr/bin/ld: cannot find -lboost_system
collect2: error: ld returned 1 exit status

$ g++ -lboost_system-mt -Wall test.cpp -o main                                                                                                                 
/usr/bin/ld: cannot find -lboost_system-mt
collect2: …
Run Code Online (Sandbox Code Playgroud)

c++ boost g++ linker-errors ld

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

c++ ×4

boost ×3

g++ ×2

cmake ×1

ld ×1

linker-errors ×1

linux ×1