Re: Any one compiled gtk+ program with C++ code?



On Tue, 16 Oct 2001 20:52:55 -0400 (EDT)
Pengjun Pei <ppei cse Buffalo EDU> wrote:

> Hi
> My main program is written in C and gtk+
> then I used CC to compile,it works fine.
> Then I want to use self-defined object in this main
> program so I included my own .h file which
> defines the class.Just then,it gives ERRORS
> when compileing!!!
> I didn't even try to use the object!
> Only #included the .h file.
> And the error seems come from some definition
> conflict,right? Any suggest is highly appreciated!
> 
> The error messages are as follows:
> 
> "/usr/include/wchar.h", line 21: Error: Multiple declaration for std::tm.
> "/usr/include/time.h", line 30: Error: Multiple declaration for std::tm.
> "/opt/SUNWspro/WS6/include/CC/Cstd/rw/traits", line 517: Error:
> Cannot return void* from a function that should return const char*.
> "/opt/SUNWspro/WS6/include/CC/Cstd/rw/locimpl", line 243: Error:
> Cannot return void* from a function that should return
> __rwstd::facet_imp*.
> "/opt/SUNWspro/WS6/include/CC/Cstd/rw/ctype", line 491: Error:
> Could not find a match for std::ctype<char>::ctype(void*, bool, int).
> "/opt/SUNWspro/WS6/include/CC/Cstd/rw/vendor", line 59: Error:
> Could not find a match for std::ctype<char>::ctype(void*, bool, int).
> exit6 Error(s) detected.
> *** Error code 6

Ya, I've hit this before...
(You're obviously using Solaris, with its native C++ compiler...)
I forgot exactly how I tracked this down now, but in order to compile, all
our (relevant) C++ files look like this:

        ...
        #include <stddef.h> // Get the right NULL (GTK is broken)
        #ifdef __SUNPRO_CC
        #include <wchar.h> // Needed before gtk.h
        #endif
        #include <gtk/gtk.h>
        ...

We work on multiple C++ compilers, on multiple platforms, and this seems to
work everywhere (using gtk 1.2.x)

Like I said, I forgot exactly how I discovered this fix(?) (Nor do I
remember if the problem is with Solaris or GTK).  I'm hoping when we move
to gtk 1.3/2.0 that it isn't needed any more...
Ian



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