windows-7 - 使用 MinGW 和 Eclipse CDT 进行 CMake

标签 windows-7 cmake eclipse-cdt mingw32

我正在尝试在 Windows 7(64 位)上使用 Cmake 编译 OpenCV。它将与 Eclipse 和 CDT 一起使用,为此我在某处读到,无论编译器如何,您都必须指定 Unix Makefiles。
现在,鉴于我也有 cygwin(对于 Android NDK 的东西),我首先尝试使用它的编译器,并且我成功配置了 CMake 并生成了 makefile,但是当 OpenCV 吐出错误时(关于 ffmpeg 和模块)。所以我切换到 MinGW(HelloWorld 也很痛苦,我必须指定 MinGW g++ 的完整路径,而不管 PATH 变量设置如何),但现在我什至无法配置 CMake。我收到以下错误:

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 shell 冲突?),我将不胜感激。提前致谢!

最佳答案

我们在使用“Unix Makefiles”生成器时遇到了同样的问题。我们通过使用“MSYS Makefiles”生成器解决了这个问题(Msys 是 MinGW 周围的 shell 环境,就像 [一个非常小的] cygwin)。

关于windows-7 - 使用 MinGW 和 Eclipse CDT 进行 CMake,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5178788/

相关文章:

eclipse-cdt - 在 Eclipse IDE 中,如何以十六进制而不是十进制显示悬停值?

Eclipse CDT,不能使用调试器(始终停留在89%的进程上)

c++ - Eclipse CDT C++ NULL 未解析

java - 无法构建项目,出现错误 - 体系结构 x86_64 的 undefined symbol : "_JNI_CreateJavaVM"

qt - QT VC CMake编译器路径

database - 共享文件夹 : fatal error C1033: cannot open program database 上的 Visual Studio 2010 项目

visual-studio-2008 - 需要 Windows CE 5.0 模拟器

cmake - CentOS 7 中的 cmake 版本比 CentOS 8 中的更新版本?

windows-7 - Hook protected 进程

git - 如何在 Windows 上更改 Git Bash 的默认位置?