问题
So I'm trying to build a simple opencv code but I keep getting this error and I don't seem to find any solution in the internet:
os: Windows 8.1
compiler GNU GCC 601
IDE: CLion
CMake 3.0 and mingw64
This is the code which I got from the opencv tutorial 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;
}
And the CMake file:
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} )
Is this error I get. I checked the folder C:/opencv/build/lib/ and it's empty
"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: I'm new in programming so I would appreciate some specific instructions. Thanks in advance!
来源:https://stackoverflow.com/questions/44378814/no-rule-to-make-target-c-opencv-build-lib-libopencv-world300d-dll-a-needed-b