Mingw cmake报错

$ cmake -G "MinGW Makefiles"
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/CMakeMinGWFindMake.cmake:22 (message):
  sh.exe was found in your PATH, here:
  D:/Git/usr/bin/sh.exe
  For MinGW make to work correctly sh.exe must NOT be in your path.
  Run cmake from a shell that does not have sh.exe in your PATH.
  If you want to use a UNIX shell, then use MSYS Makefiles.
Call Stack (most recent call first):
  CMakeLists.txt:1 (PROJECT)

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

解决办法:

$ cmd
Microsoft Windows [▒汾 10.0.10586]
(c) 2015 Microsoft Corporation▒▒▒▒▒▒▒▒▒▒Ȩ▒▒▒▒
F:\share\cpp\gof23\Singleton>cmake -G "MinGW Makefiles"
cmake -G "MinGW Makefiles"
-- The C compiler identification is GNU 5.1.0
-- The CXX compiler identification is GNU 5.1.0
-- Check for working C compiler: D:/TDM-GCC-64/bin/gcc.exe
-- Check for working C compiler: D:/TDM-GCC-64/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: D:/TDM-GCC-64/bin/g++.exe
-- Check for working CXX compiler: D:/TDM-GCC-64/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: F:/share/cpp/gof23/Singleton
F:\share\cpp\gof23\Singleton>make
make
Scanning dependencies of target main
[ 33%] Building CXX object CMakeFiles/main.dir/main.cpp.obj
[ 66%] Building CXX object CMakeFiles/main.dir/Singleton.cpp.obj
[100%] Linking CXX executable main.exe
[100%] Built target main
F:\share\cpp\gof23\Singleton>
lux@DESKTOP-LUX MINGW64 /f/share/cpp/gof23/Singleton (master)
$ ./main.exe
Singleton....

你可能感兴趣的:(Mingw cmake报错)