From: pavenis AT lanet DOT lv To: djgpp-workers AT delorie DOT com Date: Tue, 27 Mar 2001 11:45:51 +0300 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Problems with using std::* in DJGPP headers Message-ID: <3AC07D6F.24425.6B1305@localhost> X-mailer: Pegasus Mail for Win32 (v3.12c) Reply-To: djgpp-workers AT delorie DOT com Some of DJGPP headers (current CVS) uses using std::something; to get symbols visible in global namespace (when C++ compiler is being used, of course). When some of header files doesn't put these definitions in std namespace I'm getting compilation error with gcc-3.0 prerelease. One of examples of such bad headers in current CVS is go32.h which defines size_t when included early enough but not in std namespace. Other such headers (which doesn't put definitions in std namespace are stdio.h, stdlib.h, string.h, time.h, unistd.h and others). I only tested definitions of size_t As result I'm getting compilation error on following source #include #include or #include #include I think one need binaries of gcc-3.0 snapshot for DJGPP to mess with these things or problems cannot be avoided Here is one example which shows how we could workaround these problems (tested with gcc-3.0 snapshot only) #define __DJ_size_t typedef long unsigned int size_t; #ifdef __cplusplus # define __DJ_std_namespace_begin namespace std { # define __DJ_std_namespace_end } #else # define __DJ_std_namespace_begin # define __DJ_std_namespace_end #endif #define __DJ_apply_def_std(a) __DJ_std_namespace_begin a __DJ_std_namespace_end \ __DJ_apply_def_std(__DJ_size_t); #define __DJ_size_t __DJ_apply_def_std(__DJ_size_t); ----------------- output of gcc -E ------------------------------------------- # 1 "bar.cc" # 1 "c:/djgpp/bin2/../lib/gcc- lib/djgpp/3.0/../../../../include/sys/version.h" 1 # 2 "bar.cc" 2 # 14 "bar.cc" namespace std { typedef long unsigned int size_t; }; namespace std { }; Andris