Reputation: 11
I'm trying to set up CMake on Visual Studio code on my computer. I haven't coded outside of work for about a year, and I'm running into problems just setting it up. I've installed the latest version of VS Code, G++ (compiler), mingw, and CMake, including any needed extensions, but I'm still running into this upon using the VSCode "Build" button via CMake Tools:
[main] Building folder: cmakeQuickStart [proc] Executing command: C:\msys64\mingw64\bin\gcc.exe -v [proc] The command: ninja --version failed with error: Error: spawn ninja ENOENT [proc] The command: ninja-build --version failed with error: Error: spawn ninja-build ENOENT [proc] The command: make --version failed with error: Error: spawn make ENOENT [main] Unable to determine what CMake generator to use. Please install or configure a preferred generator, or update settings.json, your Kit configuration or PATH variable. Error: No usable generator found. [rollbar] Unhandled exception: Unhandled Promise rejection: build Error: Build failed: Unable to configure the project {}
This is on a HelloWorld project, and my others. I don't know where to go, I've tried dang near everything. Help!
I've tried reinstalling all my components as mentioned above, and starting a new project with the recommended Quick Start on CMake Tools. This error still shows. I've added mingw to my environment variables; I keep seeing that I should add cmake to it as wel, but I'm not sure how.
Upvotes: 1
Views: 5023
Reputation: 907
"No usable generator found"
indicates that CMake
can't determine the generator to use for building the project -- specify the generator -- add this to settings.json
(replace "MinGW Makefiles"
with the generator that you are using -- "g++.exe"
+ "gcc.exe"
with path to your compilers)"CMakeTools.generator": "MinGW Makefiles",
"CMakeTools.configureSettings": {
"CMAKE_CXX_COMPILER": "g++.exe",
"CMAKE_C_COMPILER": "gcc.exe"
}
"Error: spawn ninja ENOENT"
show that CMake
Tools can't find the Ninja build system -- install Ninja (add path to Ninja executable to system's PATH environment variable)mingw-get install ninja
once you fix all these issues, try building your project again.
Upvotes: -1