包括OpenCV和CMake Linux
昨天我制作了一个“CMakeLists.txt”文件,其中包含以下内容包括OpenCV和CMake Linux,linux,opencv,makefile,cmake,Linux,Opencv,Makefile,Cmake,昨天我制作了一个“CMakeLists.txt”文件,其中包含以下内容 cmake_minimum_required(VERSION 2.8) project( HMirror ) find_package( OpenCV REQUIRED ) add_executable( HMirror HMirror.cpp ) target_link_libraries( HMirror ${OpenCV_LIBS} ) 它工作得很好,我没有改变任何事情。。。。(真的!!!!) 今天,当我想在代码中添
cmake_minimum_required(VERSION 2.8)
project( HMirror )
find_package( OpenCV REQUIRED )
add_executable( HMirror HMirror.cpp )
target_link_libraries( HMirror ${OpenCV_LIBS} )
它工作得很好,我没有改变任何事情。。。。(真的!!!!)
今天,当我想在代码中添加一些额外的函数时,我在Linux Shell上得到了以下输出
HMirror.cpp:(.text+0x56): undefined reference to `cv::imread(std::string const&, int)'
HMirror.cpp:(.text+0x191): undefined reference to `cv::namedWindow(std::string const&, int)'
HMirror.cpp:(.text+0x1f1): undefined reference to `cv::namedWindow(std::string const&, int)'
HMirror.cpp:(.text+0x268): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
HMirror.cpp:(.text+0x2df): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
我从昨天起就没有更改过图书馆的目的地,也没有更改过代码。所以我想知道为什么它似乎不再有效。尝试明确地编写要链接的库。在Linux上,这将是
opencv\u core
,opencv\u highgui
,opencv\u imgproc
,等等
如果您从源代码处编译库,则从名称中减去lib前缀后,将在
/usr/local/lib
中找到库名称 如果您可以提供导致这些错误的链接器命令——使用类似于make VERBOSE=1