我正在做一个在线课程,尝试在 vs code 中使用 c++ 构建一个地下城爬虫,但是在导入矢量库时,它不允许我使用任何矢量命令或功能,我已经检查了我的编译器设置一切似乎都很好,但我一生都无法找出问题所在。
#include <vector>
#include "Item.h"
#include "GameCharacter.h"
#ifndef ROOM_H
#define ROOM_H
using namespace std;
class Room
{
public:
int pos;
bool isExit;
vector<Item> items;
vector<GameCharacter> enemies;
Room(int, bool, vector<Item>, vector<GameCharacter>);
void clearLoot();
void clearEnemies();
};
#endif
intellisense 似乎根本没有接收到它,但代码的其余部分似乎很好。
使用 mingw 在 Windows 上运行 VS Code
如果 IntelliSense 似乎不起作用,请确保在 VS Code 中安装了 C/C++ 扩展。之后,转到扩展设置并找到
C_Cpp > Default Intelli Sense Mode
。根据您当前的平台进行更改,例如windows-gcc-64
。