Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!orion.oac.uci.edu!uci-ics!rfg From: rfg@ics.uci.edu (Ronald Guilmette) Newsgroups: comp.lang.c++ Subject: Re: Including C files into a C++ program Keywords: C, C++, #include Message-ID: <26462D94.7559@paris.ics.uci.edu> Date: 8 May 90 02:23:16 GMT References: <1990May7.172718.3230@IRO.UMontreal.CA> Reply-To: rfg@ics.uci.edu (Ronald Guilmette) Organization: UC Irvine Department of ICS Lines: 34 In article <1990May7.172718.3230@IRO.UMontreal.CA> mailhot@IRO.UMontreal.CA (Pierre Mailhot) writes: >I'm sorry if this topic has already been covered several times before, >but I'm relatively new as regard of C++ and I'm looking for a simple way >to include C program source code into a C++ program. > >My problem is as followed: I'm currently using a modified version of the AT&T >C++ preprocessor which when I include C #include files in a C++ program >doesn't include the #define instructions from these files. > >As anybody encountered this problem and/or found a solution to it? > >Please e-mail me any answer. Sorry. I'm posting my reply because it may be of general interest. If you have a (modified & non-standard) preprocessor which is broken, the solution is to get one which is not modified and/or not broken. If you include a file, you should get the #defines in that file. For now, let's assume that you are going to get a non-broken preprocessor. Now, if you have code (either "base" files or include files) which you need to run through a C++ translator or compiler, you may (and probably will) need to make modifications to that code before it will pass cleanly through a C++ language processor. Some of the modifications can be made for you via an automated tool that I have built called protoize. This tool is freely available. Send me mail and I'll tell you how to obtain a copy. // Ron Guilmette (rfg@ics.uci.edu) // C++ Entomologist // Motto: If it sticks, force it. If it breaks, it needed replacing anyway.