小编jim*_*jim的帖子

找不到-lboost_system的库

我使用macports安装了boost.这些文件似乎在/ opt/local/include/boost /

我的makefile不再有效,我收到以下错误

Undefined symbols:
"boost::system::generic_category()", referenced from:
  __static_initialization_and_destruction_0(int, int)in client.o
  __static_initialization_and_destruction_0(int, int)in client.o
"boost::system::system_category()", referenced from:
  boost::asio::error::get_system_category()    in client.o
  boost::system::error_code::error_code()in client.o
  __static_initialization_and_destruction_0(int, int)in client.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [client] Error 1
Run Code Online (Sandbox Code Playgroud)

在学校,解决方案是使用-lboost_system作为g ++的参数,但现在我把项目带回了我的mac,这不起作用.我认为这主要是因为在学校,升级文件位于usr/local/lib(或类似的地方).

当我添加-lboost_system参数时,我收到以下消息

g++ -I/opt/local/include -lboost_system -o client client.o Packet.o
ld: library not found for -lboost_system
collect2: ld returned 1 exit status
make: *** [client] Error 1
Run Code Online (Sandbox Code Playgroud)

我尝试了一些使用-L和-l的变体,但我似乎无法找到一个有效的组合.在学校我也不必使用-L.我在这里读了一些关于类似问题的其他帖子,但是他们通过添加-l标志修复了它,这对我来说并不适用.

救命!谢谢!

c++ boost makefile boost-asio

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

标签 统计

boost ×1

boost-asio ×1

c++ ×1

makefile ×1