我已经创建了一个运行良好的简单应用程序。但是,现在我需要链接到以下目录中的一些库。
/opt/norton/lib在我的make文件中,我有以下的works,但我需要使用cmake
LIBS_PATH = -L/opt/norton/lib
INC_PATH = -I/opt/norton/inc
LIBS = -lntctrl在我的CMakeList.txt中,我有这个,但不工作,我一直得到以下错误:
undefined reference to `nt_init'这是我的CMakeList.txt
# Includes files
INCLUDE_DIRECTORIES(/opt/norton/inc)
# Link libraries
LINK_DIRECTORIES(/opt/norton/lib)
# Add the library that is used by nt_init
TARGET_LINK_LIBRARIES(-lntctrl)
ADD_LIBRARY(application initialize_nw) 非常感谢你的建议,
发布于 2009-10-28 17:06:48
试试TARGET_LINK_LIBRARIES(ntctrl),-l标志不应该在那里使用(根据我的想法猜测)
下面是我编写cmake文件的方式:
include_directories(/opt/norton/inc)
link_directories(/opt/norton/lib)
add_executable(application initialize_nw)
target_link_libraries(application ntctrl)要显示make过程中实际运行的命令行,请使用:
make VERBOSE=1也许这向您展示了手动运行的命令和cmake生成的命令之间的区别。
https://stackoverflow.com/questions/1635942
复制相似问题