Ubuntu下安装并配置VS Code编译C++的方法

2019-10-10 15:07:25王振洲

#include<iostream>
#include<stdlib.h>
using namespace std;

int main()
{
  cout<<"hello VS Code"<<endl;
  system("pause");
  return 0;
}

同样并没有卵用。那就换一种方式。

#include<iostream>
#include<stdio.h>
using namespace std;

int main()
{
  cout<<"hello VS Code"<<endl;
  getchar();
  return 0;
}

按crtl + shift + B构建,按F5运行,程序完美输出。有图为证,哈哈

后记:

期间在终端里执行了以下操作

sudo apt-get install clang

如果提示Clang有错可以运行该命令,安装clang。

那么问题来了,是不是换个文件夹每次写个代码都得配置lauch.json和task.json文件呢?或者将.vscode文件夹复制到当前文件夹下?这样岂不是很麻烦,细思极恐

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持易采站长站。