简体   繁体   中英

Eclipse/C++ cannot find header files

I've added MacOS X C++ Linker and GCC C++ Compiler Includes and Libraries libraries and paths, but I'm still unable to #include a library whose path and file I've added.

Code:
#include <opencv2/text/ocr.hpp>

Error:

fatal error: 'opencv2/text/ocr.hpp' file not found


Eclipse Setup: (Project > Properties > C/C++ Build > Settings)
MacOS X C++ Linker > Libraries
Library search paths:
/usr/local/Cellar/opencv3/3.1.0_4/lib
/usr/local/cellar/opencv3/3.1.0_4/include/opencv2
/usr/local/cellar/opencv3/3.1.0_4/include/opencv2/text
Libraries:
ocr

GCC C++ Compiler > Includes
Include paths:
/usr/local/cellar/opencv3

Mac File Structure:
ocr.hpp exists in /usr/local/cellar/opencv3/3.1.0_4/include/opencv2/text

My thoughts:

  • It seems Eclipse is still looking in ~/cellar/opencv instead of ~/cellar/opencv3 .
  • Because I can #include any libraries in /usr/local/cellar/opencv/2.4.13.1/include/opencv2 without adding paths to Eclipse project settings.
  • But I cannot #include any libraries from /usr/local/cellar/opencv3/3.1.0_4/include/opencv2

I'm used to working in Ruby where library management is super easy, so it's frying my brain a little trying to get things setup in C++. Any help would be very appreciated.

Solution:

Projects > Properties > C/C++ General > Paths and Symbols > GNU C++
Changed /usr/local/Cellar/opencv to /usr/local/Cellar/opencv3

... > Library Paths
Removed all paths and added /usr/local/Cellar/opencv3 .

Then included:
#include <3.1.0_4/include/opencv2/text/ocr.hpp>

Thanks for the assistance in the comments.

This post was also helpful:
Eclipse C/C++ (CDT) import files into project - header file not found - include path

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