2016-04-21 73 views
0

我想用mingw-w64和cmake做一个简单的编译。但由于某种原因我不能。它无法验证gcc是否可以编译奇怪的C程序。有任何想法吗?使用cmake与mingw-w64错误编译测试程序

感谢

圣保罗

C:\work\opencv\myown\hello>cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CC_COMPILER=gcc 
-- The C compiler identification is GNU 5.3.0 
-- The CXX compiler identification is GNU 5.3.0 
-- Check for working C compiler: C:/Program Files/mingw-w64/x86_64-5.3.0-win32-seh-rt_v4-rev0/mingw64/bin/gcc.exe 
CMake Error: Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_8ce25\fast" 
-- Check for working C compiler: C:/Program Files/mingw-w64/x86_64-5.3.0-win32-seh-rt_v4-rev0/mingw64/bin/gcc.exe -- broken 
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message): 
    The C compiler "C:/Program 
    Files/mingw-w64/x86_64-5.3.0-win32-seh-rt_v4-rev0/mingw64/bin/gcc.exe" is 
    not able to compile a simple test program. 

    It fails with the following output: 

    Change Dir: C:/work/opencv/myown/hello/CMakeFiles/CMakeTmp 



    Run Build Command:"nmake" "/NOLOGO" "cmTC_8ce25\fast" 



    Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" 
    "cmTC_8ce25\fast" 





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


-- Configuring incomplete, errors occurred! 
See also "C:/work/opencv/myown/hello/CMakeFiles/CMakeOutput.log". 
See also "C:/work/opencv/myown/hello/CMakeFiles/CMakeError.log". 

回答

2

在你PATHnmake可用?

可以提供使用CMAKE_MAKE_PROGRAM另一个make命令,例如像:

cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CC_COMPILER=gcc -DCMAKE_MAKE_PROGRAM=mingw32-make