【发布时间】:2016-10-20 22:51:38
【问题描述】:
我安装了微软推荐的 C/C++ 扩展。我希望现在修复编译。
我知道 Visual Studio Code 是一个没有内置编译器的编辑器,但是几乎没有关于如何完成修复配置以编译代码的任务的信息。
我运行 linux ubuntu 14.04 并安装了 gcc 编译器。我希望用它来编译代码。
我一直在查看任务,并且在调试模式下启动它时会转到此文件:
lanuch.json(这些是启动配置):
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch (GDB)",
"type": "cppdbg",
"request": "launch",
"launchOptionType": "Local",
"targetArchitecture": "x64",
"program": "enter program name, for example ${workspaceRoot}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true
},
{
"name": "C++ Attach (GDB)",
"type": "cppdbg",
"request": "launch",
"launchOptionType": "Local",
"targetArchitecture": "x64",
"program": "enter program name, for example ${workspaceRoot}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"processId": "enter program's process ID",
"externalConsole": false
}
]
}
从这里我迷路了。我实际上不知道在这里要改变什么。
同样来自这个https://code.visualstudio.com/docs/editor/tasks,还有一个任务示例:
{
"version": "0.1.0",
"command": "gcc",
"args": ["-Wall", "helloWorld.c", "-o", "helloWorld"],
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
再次,我不知道如何编辑它以便编译我的代码。
我有文件 start.cpp,其中包含我的主要功能。
那么如何设置 Visual Studio 代码以最简单、最自动化的方式编译代码?
【问题讨论】:
-
没有足够的时间来回答这个问题,希望这能给你提供信息来回答你自己的问题:blogs.msdn.microsoft.com/vcblog/2016/10/24/…
标签: c++ linux visual-studio compilation visual-studio-code