I am new to C++ and I am trying to make a little dungeon crawler game. Currently I have multiple vectors declared in my header files but they seem to give multiple errors. I have tried searching for this problem on StackOverflow but the answers don't really seem to work.
Here is one of my header files: (Hero.h)
#pragma once
class Hero {
public:
Hero();
std::string name;
int experience;
int neededExperience;
int health;
int strength;
int level;
int speed;
std::vector<Item> items = std::vector<Item>();
void levelUp();
private:
};
Here is my .cpp file: (Hero.cpp)
#include "stdafx.h"
#include <vector>
#include "Hero.h"
#include "Item.h"
Hero::Hero() {
}
void Hero::levelUp()
{
};
Like I said I am new to C++ so there might be a lot more wrong with my code than I know. This is just a test.
Below are the errors that are shown in the Error list of Visual Studio 2015:
Error C2039 'vector': is not a member of 'std' CPPAssessment hero.h 13
Error C2143 syntax error: missing ';' before '<' CPPAssessment hero.h 13
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int CPPAssessment hero.h 13
Error C2238 unexpected token(s) preceding ';' hero.h 13
Aucun commentaire:
Enregistrer un commentaire