cloud studio腾讯推出的云IDE,里面有很多现成的语言环境,这里讲一下C++的环境配置
1.选择C++环境模板创建就可以了
2.可以直接run或者g++编译
3.安装插件
第一个C++插件需要自己离线下载上传安装上去,在cloud studio的插件商店里面搜索不到
自行搜索怎么下载离线插件
4task和launch配置
{ "tasks": [ { "type": "cppbuild",//任务类型,可以取cppbuild、shell、process,三种执行时稍有差异,这里选择默认cppbuild。 "label": "build task 1",//任务标签(标记),也即任务名称,任务名称要和launch.json里的"preLaunchTask"值对应一致。 "command": "/usr/bin/g++",//编译器及其路径,.c用gcc.exe编译器,.cpp用g++.exe编译器,还可以是后面即将讲到的Cmake、make。 "args": [ "-fdiagnostics-color=always", "-g",//生成和调试有关的信息,launch.json会用到这些信息。 "${file}",//编译当前打开的.c(或.cpp)文件。 "-o",//指定编译的输出,windows系统下输出.exe文件,见下行。 //下面是windows系统下输出.exe文件及其路径,应该与launch.json的"program"的值代表的路径一致。 "${workspaceFolder}\\${fileBasenameNoExtension}.exe" ], "options": { "cwd": "${workspaceFolder}"//当前工作目录(路径)。 }, "problemMatcher": ["$gcc"],//使用gcc的问题匹配器。 "group": { "kind": "build", "isDefault": true }, "detail": "Task generated by Debugger." } ], "version": "2.0.0" }
`
{
"configurations": [
{
"name": "build launch 1",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "build task 1"
},
{
"name": "C/C++ Runner: Debug Session",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"externalConsole": false,
"cwd": "/workspace/clang-quickstart",
"program": "/workspace/clang-quickstart/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
],
"version": "2.0.0"
}`
具体配置参考这篇博客:博客