[?]jNs
27th July 2011, 11:01
Hi guys, I got a little Problem with a forward declaration. It may be solved easily, but I don't find my mistake.
I got a class TrackElement that has exactly the following header file.
#ifndef TRACKELEMENT_H
#define TRACKELEMENT_H
#include <QLabel>
#include "tracktest.h"
class TrackTest;
class TrackElement : public QLabel
{
Q_OBJECT
public:
explicit TrackElement(TrackTest *parent = 0);
private:
TrackTest test;
};
#endif // TRACKELEMENT_H
First, when I didn't use the forward declaration, the constructor had problems with it too, because im using the TrackElement to create TrackTest and vice versa.
With the forward declaration the constructor causes no errors, but my private test variable of type TrackTest does. "field 'test' has incomplete type"
I don't get it why, if I create a new TrackTest file in the TrackElement .cpp-file, there is no error at all.
Thanks for fast answers :)
I got a class TrackElement that has exactly the following header file.
#ifndef TRACKELEMENT_H
#define TRACKELEMENT_H
#include <QLabel>
#include "tracktest.h"
class TrackTest;
class TrackElement : public QLabel
{
Q_OBJECT
public:
explicit TrackElement(TrackTest *parent = 0);
private:
TrackTest test;
};
#endif // TRACKELEMENT_H
First, when I didn't use the forward declaration, the constructor had problems with it too, because im using the TrackElement to create TrackTest and vice versa.
With the forward declaration the constructor causes no errors, but my private test variable of type TrackTest does. "field 'test' has incomplete type"
I don't get it why, if I create a new TrackTest file in the TrackElement .cpp-file, there is no error at all.
Thanks for fast answers :)