나는 표준을 얻고있다 : : 나는 결코 들어 본 적이 없으며 그것에 대해 아무것도 찾을 수 없습니다. ShootManager.hC++ 벡터 구문 오류
#pragma once
#include "VGCVirtualGameConsole.h"
#include "Shot.h"
#include <vector>
using namespace std;
class ShootManager
{
public:
ShootManager();
~ShootManager();
void Destroy(int ShotNr);
void Update();
void Draw();
void Fire(Shot* shot);
vector<Shot*> shots;
};
Shot.h
#pragma once
#include "VGCVirtualGameConsole.h"
#include "ShootManager.h"
using namespace std;
class Shot
{
public:
virtual ~Shot();
virtual void Update() = 0;
void Draw();
void Move();
enum Alignment
{
FRIEND, ENEMY
};
protected:
VGCVector position;
VGCVector speed;
Alignment alignment;
bool Destroyed = false;
};
나는 이러한 오류
Error 3 error C2059: syntax error : '>'
Error 7 error C2059: syntax error : '>'
Error 1 error C2061: syntax error : identifier 'Shot'
Error 5 error C2061: syntax error : identifier 'Shot'
Error 2 error C2065: 'Shot' : undeclared identifier
Error 6 error C2065: 'Shot' : undeclared identifier
Error 4 error C2976: 'std::vector' : too few template arguments
Error 8 error C2976: 'std::vector' : too few template arguments
식별자 오류가이 라인이다 얻을
,void Fire(Shot* shot);
나머지
vector<Shot*> shots;
을 위해이 두 라인은 꽤 많은 시간 동안 완벽하게 작동하고 정말 갑자기 이러한 오류를 만들기 시작 원인을 알 수 없습니다. 아직 벡터 채우기를 시도했지만 아직 함수가 호출되지 않았습니다.
Shot.h를 포함하는 대신 ShotManager.h에'class Shot;'을 넣으면됩니다. – kfsone
@kfsone : std :: vector를 불완전한 타입으로 만들 수 없으므로 도움이되지 않습니다. – rici
그는 벡터가 아니고 벡터입니다. –
kfsone