From: axlq AT unicorn DOT us DOT com (to comp.os.msdos.djgpp) Newsgroups: comp.os.msdos.djgpp Subject: Re: RHIDE corrupting an object file? Date: 10 Jan 1999 14:44:46 GMT Organization: a2i network Lines: 47 Message-ID: <77aecu$dqv$1@samba.rahul.net> References: <779cmv$7hh$1 AT samba DOT rahul DOT net> <3698C8F7 DOT 9699710F AT gmx DOT net> NNTP-Posting-Host: waltz.rahul.net NNTP-Posting-User: unicorn To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article <3698C8F7 DOT 9699710F AT gmx DOT net>, Robert Hoehne wrote: >I wrote : >> >> When building a two-module project in RHIDE, it gets to the link phase >> and aborts the build with the message: >> >> demo.o(5) Error: unterminated string or character constant >> demo.o(1) Error: possible real start of unterminated constant >> dfltmenu.o(1) Error: syntax error before character 01 > [snip >How do you have compiled them? (in RHIDE or outside). >What have you included in your project in RHIDE? My project includes two source files, demo.c and dfltmenu.c. Both of these are C modules which must link to a C++ library, called libmenu.a. libmenu.a was built with g++, not gcc. >> The RHIDE compiler options are set as >> -x c++ >> ...to force it to compile the modules as C++. I need to do this because > >RHIDE (or better gcc) knows how to compile a file by examining >the suffix of the file. So it knows already to compile a file RHIDE doesn't know that these modules must be linked to a C++ library. Using the .c suffixes, the modules would get compiled as C modules, and fail to link to the library. Now, I suppose I can rename my modules to .cc and be done with it (in fact, that did seem to get further but I had to rename a standard library to libstdcx.a). Same problem though: the linker complains that none of the libmenu.a C++ library functions are found. I suspect the prototypes in the library's header file may need to be flagged as C++ functions. Is there a way to do it? I note that the preprocessor ignores extern "C" { } declarations. I guess the basic question is: how do I get C source modules to link to a C++ library using RHIDE? There seems to be a difference between using gcc to compile a file ending in .cc and using g++ to compile the SAME file ending in .c. A corollary question would be: how do you mix C and C++ modules together in the same project? -Alex