C++ gnome code vs. gcc-2.95.1



Hi all,
I have received a message from James Antill (cited below), saying that my
game of gnometris does not compile under gcc-2.95.1. This is a C++ code
using gnome libs without any kind of wrapper library. I don't have this
latest and greatest compiler (I use the one from RH6.0, I think it is
egcs-2.91.66), so I am unable to reproduce this, but basically the guy says
two things:

1. somehow the compiler sees the NULL macro as ((void*)0) and whines about
having to implicitly cast it to char*. I always thought that NULL is
#defined to be plain 0, without any types in front of it (that is what
Stroustrup recommends in his book). Do we redefine this macro ? I can fix my
code to use 0 instead of NULL (that's what I should have done from the very
beginning:), but the problem is, many of the NULLs come from macros in
gnome headers, like GNOMEUIINFO_END. Shouldn't they be cast to the right
thing INSIDE the macros ?

2. the _() function returns void*! This is strange I think, because it
should be used as an i18n replacement for string constants (const char*). Of
course the compiler hates this. I can put (const char*) everywhere in front
of the calls to _(), but it surely isn't the right way to fix this thing...

Can anybody responsible for gnome-libs headers respond to this ? Does
anybody know of a compiler switch for gcc-2.95.1 that would make this code
compleable ? Or do I have to recommend switching to an older compiler ?

marcin

original message:
> When compiling gnome-games-1.0.50 with gcc-2.95.1 I get the following
> errors...

> main.cpp: In function `int main(int, char **)':
> main.cpp:38: ANSI C++ forbids implicit conversion from `void *' in
initialization
> main.cpp:40: ANSI C++ forbids implicit conversion from `void *' in
argument passing
> main.cpp:44: ANSI C++ forbids implicit conversion from `void *' in
argument passing
> make[3]: *** [main.o] Error 1

> If I fix those by hand (replace NULL for 0 throughout the .cpp files)
> I then get...

> tetris.cpp: In method `Tetris::Tetris(int)':
> tetris.cpp:79: ANSI C++ forbids implicit conversion from `void *' in
argument passing
> tetris.cpp:79: ANSI C++ forbids implicit conversion from `void *' in
argument passing
> tetris.cpp:93: ANSI C++ forbids implicit conversion from `void *' in
initializat

> Which is the return value from _() ... so I guess you'd have to cast
> to (char *) ... I gave up at that point and just removed it from the
> makefile.

> -- 
> James Antill -- james@and.org
> I am always an optimist, but frankly there is no hope.
>    -Hosni Mubarek



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]