在构建 OpenMPL 项目时未定义对“boost::timer”库的引用

问题描述 投票:0回答:0

我正在尝试构建 OpenMPL 项目。然而,boost 库发生了一些错误

[ 99%] Linking CXX executable OpenMPL
CMakeFiles/OpenMPL.dir/main.cpp.o: In function `main':
main.cpp:(.text.startup+0xc4): undefined reference to `boost::timer::auto_cpu_timer::auto_cpu_timer(std::string const&)'
libOpenMPL_lib.a(SimpleMPL.cpp.o): In function `SimpleMPL::SimpleMPL::read_gds()':
SimpleMPL.cpp:(.text+0x337): undefined reference to `boost::timer::auto_cpu_timer::auto_cpu_timer(std::string const&)'
libOpenMPL_lib.a(SimpleMPL.cpp.o): In function `SimpleMPL::SimpleMPL::write_gds()':
SimpleMPL.cpp:(.text+0x1364): undefined reference to `boost::timer::auto_cpu_timer::auto_cpu_timer(std::string const&)'
libOpenMPL_lib.a(SimpleMPL.cpp.o): In function `SimpleMPL::SimpleMPL::solve()':
SimpleMPL.cpp:(.text+0xa59e): undefined reference to `boost::timer::format(boost::timer::cpu_times const&, short, std::string const&)'
SimpleMPL.cpp:(.text+0xa633): undefined reference to `boost::timer::format(boost::timer::cpu_times const&, short, std::string const&)'
SimpleMPL.cpp:(.text+0xa7dc): undefined reference to `boost::timer::format(boost::timer::cpu_times const&, short, std::string const&)'
SimpleMPL.cpp:(.text+0xa968): undefined reference to `boost::timer::format(boost::timer::cpu_times const&, short, std::string const&)'
SimpleMPL.cpp:(.text+0xaa03): undefined reference to `boost::timer::format(boost::timer::cpu_times const&, short, std::string const&)'
libOpenMPL_lib.a(SimpleMPL.cpp.o):SimpleMPL.cpp:(.text+0xaaa6): more undefined references to `boost::timer::format(boost::timer::cpu_times const&, short, std::string const&)' follow
collect2: error: ld returned 1 exit status

项目似乎无法链接 boost::timer 库。我已经使用“sudo apt install libboost-all-dev”命令安装了 libboost 并安装了 boost1.65 版本。

我该如何解决这个问题?

我试过把boost版本从1.55改成1.72(也就是项目支持的范围),尝试用其他方式安装boost。我也试过更改安装路径。但是这些还是不行。

boost cmake hyperlink undefined-reference
© www.soinside.com 2019 - 2024. All rights reserved.