libgui 0.0.4 fails with the following error when
compiled with gcc 3.4.4:
g++ -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -DHAVE_CONFIG_H
-I/usr/X11R6/include -D_LANGUAGE=1 -D_DEBUG -g -O2 -MT
guielement.lo -MD -MP -MF .deps/guielement.Tpo -c
guielement.C -fPIC -DPIC -o .libs/guielement.o
In file included from guimanager.h:34,
from guimanager.C:30:
guielement.h:61: error: expected `0' before ""
guielement.h:61: error: invalid initializer for virtual
method `virtual void CGuiElement::InternalCreate(long
unsigned int)'
guielement.h:61: error: expected `;' before ""
In file included from guielement.C:30:
guielement.h:61: error: expected `0' before ""
guielement.h:61: error: invalid initializer for virtual
method `virtual void CGuiElement::InternalCreate(long
unsigned int)'
guielement.h:61: error: expected `;' before ""
make[2]: *** [guimanager.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
guielement.C: In member function `void
CGuiElement::Create(long unsigned int, Arg*, Cardinal)':
guielement.C:77: error: `InternalCreate' undeclared
(first use this function)
guielement.C:77: error: (Each undeclared identifier is
reported only once for each function it appears in.)
make[2]: *** [guielement.lo] Error 1
make[2]: Leaving directory `/tmp/libgui-0.0.4/gui'
The attached patch changes virtual functions from using
'= NULL' to '= 0'. The table.C inclusion in the prior
patch for libgui 0.0.3 was a mistake on my part, sorry.
This patch is successfully tested with gcc 3.3.6 as well.
Logged In: YES
user_id=95198
Here's a link where OpenTNL ran into the same issue:
http://www.garagegames.com/mg/forums/result.thread.php?qt=24387.
From `man gcc`:
-fpermissive
Downgrade some diagnostics about nonconformant code from
errors to warnings. Thus, using -fpermissive will allow
some nonconforming code to compile.
And from egcs 1.1
(http://www.gnu.org/software/gcc/egcs-1.1/c++features.html):
(void *)0 is no longer considered a null pointer constant;
NULL in <stddef.h> is now defined as __null, a magic
constant of type (void *) normally, or (size_t) with -ansi.
That same message is in gcc 2.8.0
(http://programming.ccp14.ac.uk/mingw32/~janjaap/mingw32/gcc-announce.html).
And from http://www.linuxquestions.org/questions/history/221322:
This is due to updates in GCC that no longer accepts the =
NULL thing. Just go to each line it complains about and
change the = NULL to = 0 and it'll compile. This change is
needed in about 10 places in two different .h files.
And from Apple
http://developer.apple.com/samplecode/MovingToGCC4/listing17.html:
ISO C++ says that a pure method is defined using the tokens
'=' and '0'. Other things that look like initializers are
not allowed, so '= 0 + 0' is not accepted, and neither is 'NULL'