VSCode+各种语言环境配置
一、C++
新建C++示例代码
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string> msg {
"Hello", "C++", "World", "from", "VS Code!"};
for (const string& word : msg)
{
cout << word << " ";
}
cout << endl;
}
点击右侧设置,选择“C/C++: g++.exe build and debug active file”即可,运行编译得到.exe文件和输出
二、C
#include <stdio.h>
#include <stdio.h>
#include <string.h>
int main()
{
char *msg ="Hello C World from VS Code!";
printf("%s",msg);
return 0;
}
点击右侧设置,选择“C/C++: gcc.exe build and debug active file”即可,运行编译得到.exe文件和输出
三、Python
msg = "Hello Python World from VS Code!"
print(msg)
因为Python环境已经添加到系统路径了,所以只需要在运行时选择Python文件即可