Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!a101!swilliam From: swilliam@a101.even.ge.com (U-E99999-Stephen Williams) Newsgroups: comp.windows.x Subject: Re: Using X11 with the Gnu C++ compiler Message-ID: Date: 18 Apr 91 20:40:22 GMT References: Sender: news@crdgw1.crd.ge.com Lines: 69 Originator: news@hpt01.even.ge.com In MBIERLAIRE@BNANDP51.BITNET ("Michel BIERLAIRE Tel. 081/72.49.23", F.N.D.P) writes: >Hello. >We are trying to develop X interfaces. For a lot of reasons, we want to use >the C++ object-oriented language. The GNU C++ compiler is available on our Deati > on 3100 (Mips). Unfortunately, this C++ compiler doesn't seem to love X ! >In fact, at compilation time, a "parse error" is detected in the >Intrinsic.h header file (line 102). We have added the -D__cplusplus definition. >No changes ! >Can you help us ? Do you know someone who develops X interfaces with a >C++ compiler ? Is the problem due to X ? to C++ ? to GNU ? ... to us ? >Thank you very much in advance. >Michel Bierlaire >Dpt of Mathematics >University of Namur >Belgium Two things, Run the headers through fix-headers to remove any K&R/Berklyisms about macro usage that is no longer allowed: #define IO_CALL x #define x(c) ioctl('c', ...) x(IO_CALL) should be changed to: #define IO_CALL 'x' #define x(c) ioctl(c, ...) and various other stuff not allowed in ANSI C. Secondly, use the gcc/g++ argument for pcc structure passing: -pcc-structure or something (not handy) This attempts to pass structures the way your standard compiler does instead of the much superior GNU method. You have to use the pcc (Portable C Compiler) style when using X libraries compiled that way. The main X stuff that uses structure passing by value is XSetargs..... It is possible I think on a particular machine for the local structure passing to be different that what pcc-structure does. The only choice then is to replace the X library with one compiled with GNU. :-) Note that the macro problems sometimes do not generate any compile errors and just do not work! This is very difficult to track down.... sdw -- Stephen D. Williams SDW Systems (513) 439-5428 GE AEG (513) 552-5237 ICBM: 39 34N 85 15W Internet: swilliam@a101.even.ge.com CIS 76244,210 sdwsys!sdw@valhalla.cs.wright.edu {}!wright!sdwsys!sdw Prodigy TPGR01A Object Oriented R&D By Horse: 10028 Village Tree Ct., Miamisburg, OH 45342