I'm having a problem with forward references.
For example,
class DATE;
class MYCLASS;
class MYCLASS
{
public:
int n;
DATE date;
};
class DATE
{
public:
int day;
int month;
int year;
};
int main(int argc, char* argv)
{
return 0;
}
results in
g++ -c -DTARGET_PC -Wall -g -I /. -I /mingw/include/ -I /devstudio/vc/include -o ./pc/impmain.o -Wno-deprecated impmain.cpp
impmain.cpp:8: field `date' has incomplete type
make: *** [pc/impmain.o] Error 1
Compilation exited abnormally with code 2 at Sat Oct 16 12:54:27
Why? I've declared the forward reference at the beginning of the file. Is
this just a stupidity of g++??
--
% Randy Yates % "Watching all the days go by...
%% Fuquay-Varina, NC % Who are you and who am I?"
%%% 919-577-9882 % 'Mission (A World Record)',
%%%% <yates@ieee.org > % *A New World Record*, ELO
For example,
class DATE;
class MYCLASS;
class MYCLASS
{
public:
int n;
DATE date;
};
class DATE
{
public:
int day;
int month;
int year;
};
int main(int argc, char* argv)
{
return 0;
}
results in
g++ -c -DTARGET_PC -Wall -g -I /. -I /mingw/include/ -I /devstudio/vc/include -o ./pc/impmain.o -Wno-deprecated impmain.cpp
impmain.cpp:8: field `date' has incomplete type
make: *** [pc/impmain.o] Error 1
Compilation exited abnormally with code 2 at Sat Oct 16 12:54:27
Why? I've declared the forward reference at the beginning of the file. Is
this just a stupidity of g++??
--
% Randy Yates % "Watching all the days go by...
%% Fuquay-Varina, NC % Who are you and who am I?"
%%% 919-577-9882 % 'Mission (A World Record)',
%%%% <yates@ieee.org > % *A New World Record*, ELO
Comment