I'm actually looking for a way to create apps with OpenCV with Clion from JetBrains.
I've installed OpenCV with Choco, so I have all the stuff in C:opencv
this is my projet with Clion
CMakeLists.txt:
cmake_minimum_required(VERSION 3.3)
project(test)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
include_directories("C:\opencv\build\include")
FIND_PACKAGE( OpenCV REQUIRED core highgui imgproc)
set(OpenCV_FOUND TRUE)
set(SOURCE_FILES main.cpp)
add_executable(prog ${SOURCE_FILES})
and the main.cpp:
#include <opencv2/opencv.hpp>
int main() {
cv::Mat img = cv::imread("./test.jpg", -1);
cv::imshow("Mon image", img);
cv::waitKey(0);
return 0;
}
and the response to build is :
undefined reference to `cv::imread(cv::String const&, int)'
and undefined errors for all OpenCV functions
Do you know why it doesn't works?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…