F
Florian Haag
Hello,
I'm trying to compile a programme which compiles fine under Linux; I'm
trying it with MinGW G++ 3.4.2:
Component.h:
#ifndef COMPONENT_H_
#define COMPONENT_H_
#include "../basics/Rectangle.h"
class Component {
private:
Rectangle *bounds;
// Unique identifier
long id;
// more declarations
};
#endif
Rectangle.h (relative path is as included above):
#ifndef RECTANGLE_H_
#define RECTANGLE_H_
#include "Point.h"
class Rectangle
{
// some declarations
};
#endif
Point.h (same directory as Rectangle.h)
#ifndef POINT_H_
#define POINT_H_
class Point {
// some declarations
};
#endif
Now, in Windows, I always get the following compilation errors (where
line 25 in Component.h matches the line "Rectangle *bounds;" shown
above):
In file included from visdgetsbase.h:13,
from main.cpp:14:
widgets/Component.h:25: error: ISO C++ forbids declaration of
`Rectangle' with n
o type
widgets/Component.h:25: error: expected `;' before '*' token
widgets/Component.h:41: error: ISO C++ forbids declaration of
`Rectangle' with n
o type
widgets/Component.h:41: error: expected `;' before '*' token
widgets/Component.h:43: error: variable or field `setBounds' declared
void
widgets/Component.h:43: error: expected `;' before '(' token
So, why isn't Rectangle recognized as a type?
I tried removing the relative path in #include, but that only results
in an additional error message saying that the file Rectangle.h wasn't
found at all. I also made sure I don't have any other file called
Rectangle.h on my entire hard disk, so quite obviously, with the
relative paths given in the #include directive, the correct file
should've been found, then why isn't the type Rectangle?
Thanks in advance,
Florian
I'm trying to compile a programme which compiles fine under Linux; I'm
trying it with MinGW G++ 3.4.2:
Component.h:
#ifndef COMPONENT_H_
#define COMPONENT_H_
#include "../basics/Rectangle.h"
class Component {
private:
Rectangle *bounds;
// Unique identifier
long id;
// more declarations
};
#endif
Rectangle.h (relative path is as included above):
#ifndef RECTANGLE_H_
#define RECTANGLE_H_
#include "Point.h"
class Rectangle
{
// some declarations
};
#endif
Point.h (same directory as Rectangle.h)
#ifndef POINT_H_
#define POINT_H_
class Point {
// some declarations
};
#endif
Now, in Windows, I always get the following compilation errors (where
line 25 in Component.h matches the line "Rectangle *bounds;" shown
above):
In file included from visdgetsbase.h:13,
from main.cpp:14:
widgets/Component.h:25: error: ISO C++ forbids declaration of
`Rectangle' with n
o type
widgets/Component.h:25: error: expected `;' before '*' token
widgets/Component.h:41: error: ISO C++ forbids declaration of
`Rectangle' with n
o type
widgets/Component.h:41: error: expected `;' before '*' token
widgets/Component.h:43: error: variable or field `setBounds' declared
void
widgets/Component.h:43: error: expected `;' before '(' token
So, why isn't Rectangle recognized as a type?
I tried removing the relative path in #include, but that only results
in an additional error message saying that the file Rectangle.h wasn't
found at all. I also made sure I don't have any other file called
Rectangle.h on my entire hard disk, so quite obviously, with the
relative paths given in the #include directive, the correct file
should've been found, then why isn't the type Rectangle?
Thanks in advance,
Florian