Reputation: 961
Though I have included the necessary .dylib files I get the following error on Xcode:
'opencv2/core/core.hpp' file not found
Upvotes: 1
Views: 10354
Reputation: 2681
First make sure you have the correct OpenCV version installed. In my case only v2 worked.
I first uninstalled all opencv versions:
$ brew uninstall opencv@2
$ brew uninstall opencv@3
$ brew uninstall opencv@4
and installed v2 with:
$ brew install opencv@2
Reinstalling could have worked, but I didn't test it. Something broke with my previous installation when I migrated to Catalina.
I then used the following flags when compiling (you may need different flags):
-I/usr/local/opt/opencv@2/include -L/usr/local/opt/opencv@2/lib -lopencv_highgui -lopencv_features2d -lopencv_imgproc -lopencv_core
Upvotes: 3
Reputation: 31
I got the same error when setting up my first OpenCV C++ project in Xcode, following these instructions: https://medium.com/@jaskaranvirdi/setting-up-opencv-and-c-development-environment-in-xcode-b6027728003
What fixed it was to set the Header Search Path and Library Search Path to recursive and maybe it helped to set the Framework search path to /usr/local/lib (and recursive) and Always Search User Paths to Yes.
In Xcode, double click the search path to set them to recursive. Set Header Search Path and Library Search Path to recursive
Upvotes: 3