Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!maverick.ksu.ksu.edu!ux1.cso.uiuc.edu!yoyodyne!pwebb From: pwebb@yoyodyne.ncsa.uiuc.edu (Peter Webb) Newsgroups: comp.windows.x.motif Subject: g++ and Motif Message-ID: <1991Feb9.210235.9051@ux1.cso.uiuc.edu> Date: 9 Feb 91 21:02:35 GMT Sender: news@ux1.cso.uiuc.edu (News) Distribution: na Organization: National Center for Supercomputing Applications at Urbana Illinois Lines: 55 I'm having trouble getting a g++ program that uses Motif/X to compile. I've localized the problem as follows: In there is the following code fragment: #if defined(__cplusplus) || defined(c_plusplus) #define CONST const /* make const String do the right thing */ #define String char* #else #define CONST #endif /* __cplusplus */ This is followed (at some distance) by the following line: typedef char *String; So, when __cplusplus or c_plusplus is defined, the compiler tries to parse typedef char *char *; which is clearly non-sensical. I have installed patches to the X code up to number 18, the latest I saw on expo.lcs.mit.edu. Are there later patches? Is this a known problem? Are there other fixes for compiling with g++? FYI, I am using g++ 1.37.1, Motif 1.1, X11R4 - patch level 18, on a Sun3 running SunOS4. The error can be reproduced with the following code: #include #include main() { Widget x; cout << "Party on!\n"; } I use the following compile line: g++ -I/stg2/GNU/lib/gcc-include -D__cplusplus -Dc_plusplus -sun3 -o test2 test2.c And get this error: In file included from //usr/include/sys/file.h:39, from /stg2/GNU/lib/g++-include/sys/file.h:18, from /usr/include/X11/Xos.h:81, from /usr/include/X11/Intrinsic.h:36, from test2.c:2: /usr/include/sys/fcntlcom.h:62: warning: `flock' was declared `extern' and later `static' In file included from test2.c:2: /usr/include/X11/Intrinsic.h:102: parse error before `char' Peter Webb (pwebb@ncsa.uiuc.edu)