【发布时间】:2019-09-23 14:31:32
【问题描述】:
我正在使用 CMake 来构建我的项目。它显示错误
./../x86_64-conda_cos6-linux-gnu/bin/ld: /home/lee/bin/ants/lib/libitkgdcmopenjp2-5.0.a(tcd.c.o): 在函数'opj_tcd_init_encode_tile'中: tcd.c:(.text+0x1d42): undefined reference to '__pow_finite'
我用谷歌搜索,它说我必须包含额外的库,即数学库 lm。我尝试了两种方法:
使用
cmake CMAKE_SHARED_LINKER_FLAGS="-lm" ..构建但是,它不起作用在 CMakeLists.txt 中添加
lm:target_link_libraries(lm myprogram ${ITK_LIBRARIES})。但它显示错误Cannot specify link libraries for target "lm" which is not built by this project.
你能告诉我任何修复它的建议吗?
【问题讨论】:
标签: c++ cmake ubuntu-16.04