所以我正在尝试构建一个简单的opencv代码,但我一直收到此错误,我似乎没有在互联网上找到任何解决方案:
os:Windows 8.1
编译器GNU GCC 601
IDE:CLION
CMake 3.0和mingw64
这是我从opencv教程page
获得的代码#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char** argv )
{
if ( argc != 2 )
{
printf("usage: DisplayImage.out <Image_Path>\n");
return -1;
}
Mat image;
image = imread( argv[1], 1 );
if ( !image.data )
{
printf("No image data \n");
return -1;
}
namedWindow("Display Image", WINDOW_AUTOSIZE );
imshow("Display Image", image);
waitKey(0);
return 0;
}
和CMake文件:
cmake_minimum_required(VERSION 3.0)
project(opencv)
set("OpenCV_DIR" "C:/opencv/build")
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable(opencv exemple.cpp)
target_link_libraries( opencv ${OpenCV_LIBS} )
我得到了这个错误。我检查了文件夹C:/ opencv / build / lib /并且它是空的
"C:\Program Files\JetBrains\CLion 2017.1.2\bin\cmake\bin\cmake.exe" --build
"C:\Users\Jorge Rodriguez\Downloads\opencv-tutorial-clion-master\opencv-
tutorial-clion-master\cmake-build-debug" --target all -- -j 4
Scanning dependencies of target opencv
mingw32-make.exe[2]: *** No rule to make target
'C:/opencv/build/lib/libopencv_world300d.dll.a', needed by 'opencv.exe'. Stop.
mingw32-make.exe[2]: *** Waiting for unfinished jobs....
[ 50%] Building CXX object CMakeFiles/opencv.dir/exemple.cpp.obj
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/opencv.dir/all' failed
mingw32-make.exe[1]: *** [CMakeFiles/opencv.dir/all] Error 2
mingw32-make.exe: *** [all] Error 2
Makefile:82: recipe for target 'all' failed
P.S:我是编程新手,所以我会很感激一些具体的指示。提前谢谢!