0

I created a cocos2d project and when I want to execute the cmake command I got this problem

-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:30 (project):
  No CMAKE_C_COMPILER could be found.



CMake Error at CMakeLists.txt:30 (project):
  No CMAKE_CXX_COMPILER could be found.



-- Configuring incomplete, errors occurred!
See also "D:/Game/MyGame/proj.win32/CMakeFiles/CMakeOutput.log".
See also "D:/Game/MyGame/proj.win32/CMakeFiles/CMakeError.log".

pitiky0
  • 11
  • 1
  • 2
  • Do you have a C or C++ compiler installed on your system? Is the path to those compiler executables set as PATH environment variable? – kiner_shah Dec 27 '21 at 10:45
  • yes i have it ` C:\Users\me>where gcc C:\MinGW\bin\gcc.exe C:\Users\me>where g++ C:\MinGW\bin\g++.exe ` – pitiky0 Dec 27 '21 at 10:52
  • The line `-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.` suggests that you configure your project for Visual Studio. That tool cannot use MinGW compiler. For configure the project for MinGW, select [MinGW Makefiles](https://cmake.org/cmake/help/latest/generator/MinGW%20Makefiles.html) generator. – Tsyvarev Dec 27 '21 at 11:36
  • Does this answer your question? [CMake does not find Visual C++ compiler](https://stackoverflow.com/questions/31619296/cmake-does-not-find-visual-c-compiler) – user7610 Jul 12 '22 at 13:57

2 Answers2

0

Look into the CMakeError.log, as indicated in the error message

See also "D:/Game/MyGame/proj.win32/CMakeFiles/CMakeError.log".

Next, consult various duplicates of this question to see suggestions how to respond to what you find in the log

user7610
  • 25,267
  • 15
  • 124
  • 150
0

I struggled for hours and found out a solution finally:

  • step 1: activate visual studio
  • step 2: run C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat to set up enviroment. (modify the path to fit your system)
vacing
  • 646
  • 6
  • 9