简体   繁体   中英

CodeLite opencv path

I am trying to use OpenCV framework in CodeLite. I am a MacOS user.

I downloaded OpenCV 4.1.0 on the official website, and it contains opencv2.framework. But, I couldn't find a way to include it in my CodeLite project. I tried setting Linker Options and Libraries Search Paths, but it didn't work. When I tried to run a cpp file, It keeps giving me (because of #include <opencv2/opencv.hpp> ) 'opencv2/opencv.hpp' file not found error.

When I try on terminal however, I could manage to compile and run a sample code. This is what I tried on terminal

g++ $(pkg-config --cflags --libs opencv4) -std=c++11 main.cpp -o main

How can I use opencv2.framework file on CodeLite for C++?

Or, Is there a way to configure CodeLite compiler such that it runs the exact expression that worked for terminal?

I recently had a similar problem trying to compile a C++ codelite project which uses OpenCV 4.1.0 on a Mac. After some trial and error, the following steps resolved it:

  1. create a new folder /usr/local/opencv2
  2. copy the contents of /Library/Frameworks/opencv2.framework/Versions/A/Headers into that new folder
  3. in codelite, set the linker options for the release build of the project to:

    -F/Library/Frameworks -framework opencv2 -framework CoreMedia -framework AudioToolbox -framework CoreGraphics -framework CoreVideo -framework AVFoundation -framework CoreFoundation -framework Cocoa -framework OpenGL -framework IOKit -framework OpenCL -framework Foundation -framework Accelerate

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM