- 新建一个空目录
mkdir oj
cd oj
- 创建cpp文件 helloworld.cpp
复制以下测试代码:
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string> msg {"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"};
for (const string& word : msg)
{
cout << word << " ";
}
cout << endl;
}
- 参照下面的参考文献
- https://www.cnblogs.com/BYGAO/p/15135609.html 【比较详细】
- https://code.visualstudio.com/docs/cpp/config-clang-mac 【官网】
- https://zhuanlan.zhihu.com/p/348111473 【解决了vector的报错】
- https://blog.csdn.net/neptune4751/article/details/105925558/ 【看起来比较简单还没试】