2012-03-06 177 views
2

我想在Windows上使用CMAKE和MinGW在Windows上编译OpenCV。然而,当我尝试这样做,我收到以下错误:Cmake与MinGW失败编译测试

The C compiler identification is GNU 
The CXX compiler identification is GNU 
Check for working C compiler: C:/MinGW/bin/gcc.exe 
CMake Error: Generator: execution of make failed. Make command was: make "cmTryCompileExec\fast" 
Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken 
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE): 
    The C compiler "C:/MinGW/bin/gcc.exe" is not able to compile a simple test program. 

有谁知道这可能是一个问题?

+0

我有一个类似的错误。我的问题是一个不完整的MinGW安装。据我所知,gcc只是简单地失踪了。 – tssch 2013-09-03 15:08:43

回答

1

你在MinGW shell或CMD.exe中运行CMAKE吗?我可以给你的第一个建议是使用MinGW shell,因为用这种方法可以更好地为编译器设置好几个环境变量。否则,你可能需要稍微调整一下你的Windows环境变量。

您可能还安装了Cygwin(并且在cygwin中也安装了gcc)。在这种情况下,如果使用CMD.exe,并且首先读取的是Cygwin的bin目录,而不是系统PATH变量中MinGW的bin目录,则也可能会出现此类错误。