视觉工作室代码任务,该任务获取C和CPP文件
尝试创建gcc
编译Visual Studio Code
的任务,同时使用*。CPP
和*。*。C
文件。我试图使用模式:
"${workspaceFolder}/*.c*"
这不好,因为它包含*。代码workspace
文件,
("${workspaceFolder}/*.c*|${workspaceFolder}/*.cpp")
这根本不在正则表达式上进行处理。
如何构建*。c
和*。cpp
文件的模式?
任务:JSON:
{
"type": "cppbuild",
"label": "gcc",
"command": "/usr/bin/gcc",
"args": [
"-fdiagnostics-color=always",
"-g",
"${workspaceFolder}/*.c",
"-pthread",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: /usr/bin/gcc"
}
Trying to create gcc
compile task for Visual Studio Code
that takes both *.cpp
and *.c
files. I was trying to use patterns:
"${workspaceFolder}/*.c*"
This is not good, because it includes *.code-workspace
file
("${workspaceFolder}/*.c*|${workspaceFolder}/*.cpp")
This is not treated at regular expression at all.
How to build pattern that takes *.c
and *.cpp
files?
tasks.json:
{
"type": "cppbuild",
"label": "gcc",
"command": "/usr/bin/gcc",
"args": [
"-fdiagnostics-color=always",
"-g",
"${workspaceFolder}/*.c",
"-pthread",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: /usr/bin/gcc"
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此
tasks.josn
对我有用。我的演示项目的结构看起来像这样:
This
tasks.josn
works for me.The structure of my demo project looks like this: