编译项目时,用到external library (matlab,需要用到它的libeng.so和libmx.so库),CMakeLists.txt中有这么一句:
LINK_LIBRARIES("/opt/MATLAB/R2012a/bin/glnxa64")
编译时会报如下警告和错误:
LINK_LIBRARIES("/opt/MATLAB/R2012a/bin/glnxa64")
编译时会报如下警告和错误:
$ sudo make
-- Configuring done
WARNING: Target "myProject" requests linking to directory "/opt/MATLAB/R2012a/bin/glnxa64". Targets may link only to libraries. CMake is dropping the item.
-- Generating done
-- Build files have been written to: /opt/matlabEngine_example3_cmake
Linking CXX executable myProject
/usr/bin/ld: cannot find -leng
/usr/bin/ld: cannot find -lmx
collect2: ld returned 1 exit status
make[2]: *** [myProject] Error 1
make[1]: *** [CMakeFiles/myProject.dir/all] Error 2
make: *** [all] Error 2
错误提示很显然,找不到libeng.so和libmx.so库。搜索一下它们所在路径,就是在/opt/MATLAB/R2012a/bin/glnxa64目录下:
$ locate libe