我知道会有这样的问题困扰你。但这对我来说很奇怪。请耐心让我完成我的问题陈述。
背景:windows vista,cygwin最新版本,opencv 2.4.3
我的项目制作文件像这样,因为 opencv 安装在 d:\Application\OpenCV2.4.3\opencv :
OPENCV=/cygdrive/d/Application/OpenCV2.4.3/opencv/build
CUSTOM_INCLUDES+=-I${OPENCV}/include -I${OPENCV}/include/opencv -I${OPENCV}/include/opencv2/ml -I${OPENCV}/include/opencv2/highgui -I${SRC_DIR}
CUSTOM_LIBRARIES+= -L${OPENCV}/x86/mingw/lib -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_objdetect
需要构建的头文件是这样的:
#include <iostream>
#include <string>
#include <opencv2/core/core.hpp>
#include <opencv2/core/core_c.h>
blablabla...
当我执行:
g++ -c src/ObjectDetector.cpp -Wall -O3 -ffast-math -funroll-loops -I/cygdrive/d/Application/OpenCV2.4.3/opencv/build/include -I/cygdrive/d/Application/OpenCV2.4.3/opencv/build/include/opencv -I/cygdrive/d/Application/OpenCV2.4.3/opencv/build/include/opencv2/ml -I/cygdrive/d/Application/OpenCV2.4.3/opencv/build/include/opencv2/highgui -Isrc/ -o build/ObjectDetector.o
糟糕,结果是:
In file included from src/ObjectDetector.cpp:10:0:
src/ObjectDetector.h:15:33: fatal error: opencv2/core/core.hpp: No such file or directory
我 100 persent 确定 opencv2/core/core.hpp 在 /cygdrive/d/Application/OpenCV2.4.3/opencv/build/include 中,并使用 "" 替代 <> 。这些都不起作用,我很痛苦。我参考了每一个谷歌搜索项目。请帮帮我。
谢谢 。