Eclipse + OpenCV + Cygwin - > cv.h:没有这样的文件或目录

时间:2013-05-13 06:47:37

标签: c eclipse opencv

您好我在Eclipse中遇到麻烦,包括OpenCV Library。我遵循了很多教程,但我无法编译任何东西。这是控制台的输出。

Building file: ../hand.c
Invoking: Cygwin C Compiler
gcc -O2 -g -Wall -c -fmessage-length=0 -MMD -MP -MF"hand.d" -MT"hand.d" -o"hand.o" "../hand.c"
cygwin warning:
  MS-DOS style path detected: D:\Eclipse_workspace_C++\HelloWorld\Default
  Preferred POSIX equivalent is: /cygdrive/d/Eclipse_workspace_C++/HelloWorld/Default
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
../hand.c:3:16: fatal error: cv.h: No such file or directory
compilation terminated.
subdir.mk:18: recipe for target `hand.o' failed
make: *** [hand.o] Error 1

我正在使用OpenCV2.0。

我在proyect属性中配置了C / C ++ Build - >设置 - >工具设置标签 - >编译器和链接器添加opencv的库和头文件,但我无法编译它。

我的eclipse项目的ScreenShoot。

enter image description here

1 个答案:

答案 0 :(得分:2)

解决!

在Windows中配置Eclipse和OpenCV 2.4.5的步骤

1)安装Opencv后,在环境路径中包含安装opencv的目录,我的是opencv \ opencv2.4.5 \ build \ include

2)我使用Cygwin编译c文件。因此,使用CDT for Cygwin配置您的eclipse,并在项目设置中配置下一个配置。

Settings Compiler

Settings Linker

如果你使用mingw放在链接器设置中。对我而言,这只是vc9。

3)我的源文件就像

  #include <stdio.h>
    #include <stdlib.h>

    #include <cv.h>

    int main(void) {
        puts("Hello World!!!");
        return EXIT_SUCCESS;
    }
相关问题