PDA

View Full Version : Declaration problems



scarvenger
7th May 2007, 01:27
Hi,

This is giving me some headache:



//FILE: AREA.H

#ifndef AREA_H
#define AREA_H

#include <QObject>

#include "camera.h"

class Area
{
public:
Area(QString text);
~Area();

static void Dispose();

static QList<Area*> *areas;

QList<Camera*> *cameras;
QString text;
private:
QString name;
};

#endif

//FILE:CAMERA.H

#ifndef CAMERA_H
#define CAMERA_H

#include <QObject>

#include "area.h"

class Camera
{
public:
Camera(QString text, Area* parentArea);
~Camera();

QString text;
private:
Area* parentArea;
QString name;
};

#endif


Compiler output: "src/camera.h:14: error: 'Area' was not declared in this scope"

*forward declaration*

I thought the issue is on the fact that area.h is including camera.h and vice-versa, so i tried to add "class Camera;" in area.h and "class Area;" in camera.h and then it gave the following output:

"src/....../camera.h:14: error: ''Area' is not a type"
"src/....../listwidgethandler.h:20: error: 'Area' is not a type"
"src/....../listwidgethandler.h:21: error: 'Camera' is not a type"

Ideas??

Compiler: GCC 4.1
OS: Linux Kubuntu Feisty Fawn (7.03)
IDE: QDevelop

scarvenger
7th May 2007, 03:05
Ok, i found what was wrong: i had the following piece of code:



enum Types
{
Camera,
Area
};


So frustrating [:P]