我试图将现有的c++
项目转换为CMake
。现有的makefile运行良好,我已成功转换类似的。但是当我尝试转换这个时,发生了一些令人困惑的错误,如下所示:
18:22:10: Running steps for project encryption...
18:22:10: Starting: "/export/opt/cmake-3.2.2/bin/cmake" --build . --target all
Linking CXX executable dist/Debug_64/GNU-Linux-x86/encryption
CMakeFiles/encryption.dir/encryption.cc.o: In function `main':
/export1/chao/nanos/nano_clean/nano_clean/src/encryption/encryption.cc:33: undefined reference to `stlp_std::cout'
...
/export1/chao/nanos/nano_clean/nano_clean/lib/STLport/stlport/stl/_string.c:604: undefined reference to `stlp_std::__stl_throw_out_of_range(char const*)'
...
起初我认为它无法找到iostream
,所以我在/ iostream
添加了export1/chao/nanos/nano_clean/nano_clean/lib/STLport/stlport/ by using 'INCLUDE_DIRECTORIES'
,但它无效。你能给我一些建议吗?
我的CMakeLists.txt如下:
include_directories(/export1/chao/nanos/nano_clean/nano_clean/lib/STLport/stlport)
include_directories(/export1/chao/nanos/nano_clean/nano_clean/lib/STLport/stlport/h/using)
include_directories(/export1/chao/nanos/nano_clean/nano_clean/lib/boost/1.49.0/boost/tr1/tr1)
link_directories(
../common/dist/${CONF}/GNU-Linux-x86
/export2/chao/nanos/nano_built/lib/tiburonda/dist/include
)
aux_source_directory(. SRC_LIST)
include_directories(../common/include
)
add_executable(encryption ${SRC_LIST})
target_link_libraries(encryption libcommon.a)
根据original makefile
,我发现此项目在source file
使用encryption.cc
./
header files
:encryption.h
./
以及../common/include
的其他人。