Beat
Beat

Reputation: 51

cmake in vsc doesn't find generator

I need help. I tried everything. I want build a project with cmake in C++ in visual studio code. I always get this error message.

[variant] Loaded new set of variants
[kit] Successfully loaded 9 kits from C:\Users\beatb\AppData\Local\CMakeTools\cmake-tools-kits.json
[kit] Failed to parse cmake.exe: 
SyntaxError: JSON5: invalid character 'M' at 1:1
at syntaxError (c:\Users\beatb\.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:35543:17)
at invalidChar (c:\Users\beatb\.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:35488:12)
at Object.value (c:\Users\beatb\.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:34747:15)
at lex (c:\Users\beatb\.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:34538:42)
at Object.parse (c:\Users\beatb\.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:34485:17)
at readKitsFile (c:\Users\beatb\.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:57032:26)
at async Object.getAdditionalKits (c:\Users\beatb\.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:57088:48)
at async KitsController.readKits (c:\Users\beatb\.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:57264:35)
at async Function.init (c:\Users\beatb\.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:57208:9)
at async Function.init (c:\Users\beatb\.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:55478:32)
at async CMakeToolsFolderController._addFolder (c:\Users\beatb\.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:55727:22)
at async CMakeToolsFolderController.loadAllCurrent (c:\Users\beatb\.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:55679:17)
at async ExtensionManager._init (c:\Users\beatb\.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:54050:13)
at async Function.create (c:\Users\beatb\.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:54102:9)
at async setup (c:\Users\beatb\.vscode\extensions\ms-vscode.cmake-tools-1.9.2\dist\main.js:55194:32)
at async Promise.all (index 0)
at async Promise.all (index 100)
at async Promise.all (index 1)
[proc] Executing command: C:\msys64\mingw64\bin\x86_64-w64-mingw32-gcc.exe -v
[main] Configuring folder: HelloWorld 
[proc] Executing command: "C:\Program Files\Cmake\bin\cmake.exe" --no-warn-unused-cli - 
DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug - 
DCMAKE_C_COMPILER:FILEPATH=C:\msys64\mingw64\bin\x86_64-w64-mingw32-gcc.exe - 
DCMAKE_CXX_COMPILER:FILEPATH=C:\msys64\mingw64\bin\x86_64-w64-mingw32-g++.exe - 
Hc:/Users/beatb/OneDrive/Documents/Programmieren/C++/HelloWorld - 
Bc:/Users/beatb/OneDrive/Documents/Programmieren/C++/HelloWorld/build -G "MSYS Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error: CMake was unable to find a build program corresponding to "MSYS         
Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
[cmake] CMake Error: CMake was unable to find a build program corresponding to "MSYS Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
[cmake] CMake Error: CMAKE_AR was not found, please set to archive program. 
[cmake] -- Configuring incomplete, errors occurred!
[main] Configuring folder: HelloWorld 
[proc] Executing command: "C:\Program Files\Cmake\bin\cmake.exe" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=C:\msys64\mingw64\bin\x86_64-w64-mingw32-gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\msys64\mingw64\bin\x86_64-w64-mingw32-g++.exe -Hc:/Users/beatb/OneDrive/Documents/Programmieren/C++/HelloWorld -Bc:/Users/beatb/OneDrive/Documents/Programmieren/C++/HelloWorld/build -G "MSYS Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error: CMake was unable to find a build program corresponding to "MSYS Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
[cmake] CMake Error: CMake was unable to find a build program corresponding to "MSYS Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
[cmake] -- Configuring incomplete, errors occurred!
[cmake] CMake Error: CMAKE_AR was not found, please set to archive program. 
[main] Restarting the CMake driver after a generator change.
[proc] Executing command: C:\msys64\mingw64\bin\x86_64-w64-mingw32-gcc.exe -v
[cmakefileapi-driver] Removing c:/Users/beatb/OneDrive/Documents/Programmieren/C++/HelloWorld/build/CMakeCache.txt
[rollbar] Unhandled exception: Unhandled Promise rejection: quickStart Error: No usable generator found. {}
[main] Restarting the CMake driver after a generator change.
[rollbar] Unhandled exception: Unhandled Promise rejection: quickStart Error: No usable generator found. {}
[rollbar] Unhandled exception: Unhandled Promise rejection: quickStart Error: No usable generator found. {}
[main] Restarting the CMake driver after a generator change.
[rollbar] Unhandled exception: Unhandled Promise rejection: quickStart Error: No usable generator found. {}
[main] Restarting the CMake driver after a generator change.
[rollbar] Unhandled exception: Unhandled Promise rejection: quickStart Error: No usable generator found. {}
[rollbar] Unhandled exception: Unhandled Promise rejection: quickStart Error: No usable generator found. {}
[main] Restarting the CMake driver after a generator change.
[rollbar] Unhandled exception: Unhandled Promise rejection: quickStart Error: No usable generator found. {}
[rollbar] Unhandled exception: Unhandled Promise rejection: quickStart Error: No usable generator found. {}
[main] Restarting the CMake driver after a generator change.
[rollbar] Unhandled exception: Unhandled Promise rejection: quickStart Error: No usable generator found. {}

This is the the code in my settings.json

{
"files.autoSave": "afterDelay",
"kite.showWelcomeNotificationOnStartup": false,
"code-runner.executorMap": {

    "c": "cd $dir && gcc *.c -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
    "cpp": "cd $dir && g++ *.cpp -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
},
"code-runner.runInTerminal": true,
"code-runner.ignoreSelection": true,
"cmake.configureOnOpen": true,
"cmake.cmakePath": "C:\\Program Files\\Cmake\\bin\\cmake.exe",
"cmake.additionalKits": [
    "C:\\Program Files\\Cmake\\bin\\cmake.exe"
],
"cmake.generator": "mingw32-make"
}

The compiler I use is mingw. If I use the Visual Studio Build Tool as my kit everything works fine. I just have problems when I use GCC 10.3.0 x86_w64-mingw32.

I hope somebody can help me.

Upvotes: 1

Views: 4275

Answers (1)

Beat
Beat

Reputation: 51

Found the error myself. I had to change the filename "mingw32-make.exe" (in the bin Folder of MinGW) into "make.exe". Now it works perfectly.

Upvotes: 4

Related Questions