From: Sig Date: 2006-09-22T02:35:09+09:00 Subject: Re: Ruby and Borland C++ Paul Lutus wrote: > Sig wrote: > > / ... > >> If I create pure C project it works just fine. Any ideas how can I get >> it work under C++ project? I've tried to figure out what causes the >> error and looks like it's coming from win32.h where stdio.h functions >> are redeclared. > > Just based on what you have posted, you need to wrap the ruby.h header > content the same way the C and C++ headers are wrapped. > > To avoid double-reading, a typical header file will look like this: > > #ifndef UNIQUE_HEADER_NAME > #define UNIQUE_HEADER_NAME > > # header content goes here > > #endif > > This arrangement prevents multiple reads of the same header file. > > According to the error messages, it seems that the ruby.h file contains > content already read and defined in other header files. One solution is to > borrow the special defined name from a conflicting header file, and say: > > #ifndef UNIQUE_HEADER_NAME > #define UNIQUE_HEADER_NAME > #include ruby.h > #endif > > This may be too simple a solution, but it is reasonably clear that a classic > C/C++ multiple-header-read is happening. You may have to work out a more > complex solution than this example. > Thanks Paul for you reply, still I can not solve the problem. I think this part from win32.h causes the error: #if defined(__cplusplus) extern "C++" { #endif #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_SYS_UTIME_H # include #else # include #endif #include #include #if defined(__cplusplus) } #endif Looks like the same headers are defined twice as C++ and as C. Any other suggestions how to fix that? If I try to redefine them as C I get errors that types defined in stdio.h don't exist.