本人mac版本10.12.5 ,vscode版本为 1.13
步骤很简单,添加好各种与c++有关的插件后,reload一次,重启vscode。
在helloworld.cpp所在文件夹下创建.vscode文件夹,在.vscode中创建2个文件:tasks.json , launch.json
接着是各个文件的内容:
tasks.json:(编译配置,也就是用cpp生成a.out的过程)
-
{
-
// See https://go.microsoft.com/fwlink/?LinkId=733558
-
// for the documentation about the tasks.json format
-
”version”:
”0.1.0”,
-
”command”:
”g++”,
//command 和 args 组合为编译c++命令,即 g++ -g xxx.cpp -o a.out
-
”isShellCommand”:
true,
-
”args”: [
”-g”,
”${file}</span></span></span><span class="hljs-string">"</span></span>,<span clas