【发布时间】:2020-10-13 22:41:28
【问题描述】:
我在 ubuntu16 上运行 VScode,并测试 helloworld.cpp。 起初,我浏览了所有内容,然后尝试编辑 tasks.json。 我得到了错误。好的,我通过回滚取消了所有更改,它再次显示错误。 我删除 helloworld 文件夹并再次尝试 helloworld。 在终端 > 配置默认构建任务并构建之后,错误再次显示。 怎么了?它是从 vscode 获得的。
错误信息:
执行任务:/usr/bin/g++ -g /home/liwenz/helloworld/.vscode/tasks.json -o /home/liwenz/helloworld/.vscode/tasks
/usr/bin/ld:/home/liwenz/helloworld/.vscode/tasks.json:文件格式无法识别;视为链接描述文件 /usr/bin/ld:/home/liwenz/helloworld/.vscode/tasks.json:1:语法错误 collect2:错误:ld 返回 1 个退出状态 终端进程以退出代码终止:1
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
helloworld 链接是https://code.visualstudio.com/docs/cpp/config-linux
【问题讨论】:
标签: visual-studio-code compiler-errors format vscode-tasks