2011-03-03 119 views
5

我想在Windows 7(64位)上用Cmake編譯OpenCV。它將與Eclipse和CDT一起使用,爲此,我在某處讀取了無論編譯器如何指定Unix Makefiles的情況。 現在,考慮到我也有cygwin(對於Android NDK的東西),我第一次嘗試使用它的編譯器,並且我成功地配置了CMake並生成makefiles,但是在OpenCV吐出一個錯誤時只有63%的編譯結果(關於ffmpeg和HMODULE)。所以我切換到MinGW(HelloWorld,這也是一個痛苦,我不得不指定MinGW g ++的完整路徑,無論PATH變量設置如何),但現在我甚至不能配置CMake。我得到以下錯誤:CMake與MinGW和Eclipse CDT

The C compiler identification is GNU 
The CXX compiler identification is GNU 
CMake Error: your RC compiler: "CMAKE_RC_COMPILER-NOTFOUND" was not found. Please set   CMAKE_RC_COMPILER to a valid compiler path or name. 
Check for working C compiler: C:/MinGW/bin/gcc.exe 
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeRCInformation.cmake:22 (GET_FILENAME_COMPONENT): 
get_filename_component called with incorrect number of arguments 
Call Stack (most recent call first): 
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-GNU.cmake:59 (enable_language) 
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-GNU-C.cmake:1 (include) 
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeCInformation.cmake:56 (INCLUDE) 
CMakeLists.txt:2 (PROJECT) 

CMake Error: CMAKE_RC_COMPILER not set, after EnableLanguage 
CMake Error: Internal CMake error, TryCompile configure of cmake failed 
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. 

It fails with the following output: 

CMake will not be able to correctly generate this project. 
Call Stack (most recent call first): 
CMakeLists.txt:47 (project) 

Configuring incomplete, errors occurred! 

如果任何人有任何想法可能是什麼問題(?用cygwin外殼衝突),我會很感激任何輸入。提前致謝!

回答

6

我們遇到了與「Unix Makefiles」生成器相同的問題。我們通過使用「MSYS Makefiles」生成器(Msys是MinGW附近的shell環境,就像[很小的] cygwin)來解決它。

+0

謝謝,這樣做!我想我發現有關使用Eclipse CDT的Unix Makefiles的信息已經過時了,再加上我被可用的CDT選項所誤導,並沒有考慮其他選擇。編譯OpenCV,希望它現在可以在Eclipse中使用。乾杯! – vkotor 2011-03-04 14:43:23

3

此錯誤消息文本:

CMake Error: your RC compiler: "CMAKE_RC_COMPILER-NOTFOUND" was not found. 
    Please set CMAKE_RC_COMPILER to a valid compiler path or name. 

指出, 「windres」(對於MinGW和cygwin的基於GCC-構建樹)不在PATH。

windres支持,編譯Windows資源(* .rc)文件最近被添加到CMake 2.8.4中。您的MinGW環境中可能沒有windres?

+0

實際上,windres在那裏,它的目錄,和MinGW製作的一樣,包含在PATH中。但是,您指出的問題也許與我編寫HelloWorld時必須包含MinGW的完整路徑有關,無論PATH設置如何。無論如何,Rudi的解決方案似乎已經做到了,至少現在是這樣。 – vkotor 2011-03-04 14:40:19