我已经在Visual Studio代码的tasks.json
文件中创建了一个任务:
{
"label": "cmake",
"command": "cmake",
"args": [
"-G",
"\"Unix Makefiles\"",
"-DCMAKE_BUILD_TYPE=Debug",
".."
],
"options": {
"cwd": "${workspaceRoot}/build"
},
"problemMatcher": []
},
当我在VSC中运行它(任务:运行任务> cmake)时,出现以下错误:
> Executing task: cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug .. <
CMake Error: Could not create named generator "Unix Makefiles"
Generators
Unix Makefiles = Generates standard UNIX makefiles.
Ninja = Generates build.ninja files.
Xcode = Generate Xcode project files.
CodeBlocks - Ninja = Generates CodeBlocks project files.
CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
CodeLite - Ninja = Generates CodeLite project files.
CodeLite - Unix Makefiles = Generates CodeLite project files.
Sublime Text 2 - Ninja = Generates Sublime Text 2 project files.
Sublime Text 2 - Unix Makefiles
= Generates Sublime Text 2 project files.
Kate - Ninja = Generates Kate project files.
Kate - Unix Makefiles = Generates Kate project files.
Eclipse CDT4 - Ninja = Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
The terminal process terminated with exit code: 1
但是,如果我在终端中执行完全相同的命令,它将按预期工作:
oyvinds-MacBook:build oyvindhauge$ cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..-- Configuring done
-- Generating done
-- Build files have been written to: /Users/oyvindhauge/Documents/Development/[PROJECT]/build
oyvinds-MacBook:build oyvindhauge$
知道发生了什么吗?
答案 0 :(得分:0)
就像评论中所述,删除生成器参数"Unix Makefiles"
周围的多余引号解决了该问题。