- Codewarrior "Force C++ compilation" equivalent in cygwin - M68K cross-tool package
- Posted by KBG on October 12th, 2006
Hi ,
I have a mix-up of C and C++ files . I initially developed in
Codewarrior environment for Coldfire.
Now, I am migrating to Cygwin environment for development. I find that
in Codewarrior there is one
compiler option 'Force C++ compilation' that makes all the C files also
to act like C++ files .
(something like that .) So, it is possible to mix-up code /
routine-calls between C and C++ in
codewarrior and the development was easy.
I would like to know an equivalent 'Force C++ compilation' option in
Cygwin (M68K cross-Tool).
I believe that there must be a simple small flag that will do that in
Cygwin environment M68K cross-
tool package so that it would ease the development activity.
Currently, i am doing some manual coding of the following to mix-up
usage of the C and C++ code-files and i believe that there is surely
another simple way in cygwin (M68K cross-tool package).
#ifdef __cplusplus
extern "C" {
#endif
it's usually partnered at the other end of the file by
#ifdef __cplusplus
}
#endif
Is there any quivalent simple flag option in cygwin ?
Thx in advans,
Karthik Balaguru
- Posted by David Brown on October 16th, 2006
KBG wrote:
First off, you've got your compiler and environment names thoroughly
mixed up, so I'm guess that you are referring to a gcc cross-compiler
running under cygwin.
If you are trying to force all your .c files to be compiled using the
c++ compiler, you can use the switch "-x c++" to force the compilation
language, as noted in the gcc manual:
http://gcc.gnu.org/onlinedocs/gcc-4....verall-Options
Of course, that's the wrong way to handle C/C++ mixtures, just as the
"Force C++ compilation" Code Worrier flag is the wrong way to do it.
The best method is to use the #ifdef __cplusplus sequences you mentioned
to wrap all your "extern" declarations in the header files. There is no
need for these wrappers in the C files themselves, assuming each module
#include's its own header file and objects are either declared "extern"
in the header file, or "static" in the module file. Thus you compile
your C files as C files, and use the #ifdef's to get the linkage right.
- compilation CD's have an entry within "albums" for every track (Windows Media Center Edition) by dan
- compilation CD's have an entry within "albums" for every track (Windows Media Center Edition) by dan
- Cygwin environment Debugging Support for the BDM coldfire is not there with the GDB of Cygwin tool chain (Microprocessors) by KBG
- Nero Express "verifying the compilation" for four hours?!? (DVD burn took 16 minutes) (Storage Devices) by Dave Burton
- How to "join" MP3s to create a compilation. (Audio, MP3 & Music) by Mitchell199

