Hi,
I'm having trouble compiling, after writting a few lines of code, suddenly my compiler throws me an error. The error is :
GameWorld.h:38: error: ‘AsteroidList’ does not name a type
Here's the code that is related :
GameWorld.h
Code:
#ifndef GAMEWORLD_H
#define GAMEWORLD_H
#include <iostream>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <QApplication>
#include <QGridLayout>
#include <QPushButton>
#include <QPainter>
#include <list>
#include <vector>
#include "AsteroidList.h"
#include "Asteroid.h"
#include "AsteroidType1.h"
#include "AsteroidType2.h"
#include "Player.h"
#include "t_List.h"
using std::cout;
using std::istringstream;
using std::ifstream;
using std::string;
using std::cin;
using std::list;
using std::vector;
class GameWorld
{
Player p;
list<Asteroid*> L;
list<Asteroid*>::iterator i;
vector<Asteroid*> V;
t_List<Asteroid*> tList;
public:
// Error is here
AsteroidList li;
void loadData(char*,char*,int);
void drawPlayer(QPainter&);
void drawAsteroid(QPainter&);
private:
int dataType;
};
#endif
Here is my header file for #include "AsteroidList.h"
Code:
#ifndef ASTEROIDLIST_H
#define ASTEROIDLIST_H
#include <QPainter>
#include <vector>
#include <list>
#include "AsteroidNode.h"
#include "Asteroid.h"
#include "AsteroidType1.h"
#include "AsteroidType2.h"
#include "GameWorld.h"
using std::cout;
using std::vector;
class AsteroidList
{
public:
AsteroidList();
AsteroidNode* first() const;
void addAsteroidPoint(string,float,float);
void addAsteroid(string,float,float,int,int,int);
void drawAsteroids(QPainter&, int, string,int,float,float);
void drawAsteroid(QPainter&, QPolygonF,float,float);
void checkAsteroids(QPainter&, int);
void display();
void setNull();
private:
Asteroid *a_first;
};
#endif
I have no idea what happened. Can anyone share any ideas?