Christopher M. Lusardi wrote:
Hello,
I have a program that can be compiled and run on SGI and Linux computers,
and only one of the files in the program has is different. On the SGI
system, the file has a dot capital C suffix, and on Linux it has a dot
lower case c suffix.
Note that usually the latter denotes a C source file and the former
usually not. If this is not the case, you can use your approach
to put them together.
Otherwise, you at least have to change the makefiles for your project
if there are some or the way you build everything.
When I put both files in one file and surround them with precompiler
directives such as #if SGI ... #elif LINUX ... #endif, the compiler
complains when it includes other files. How can I get it to compile
and run on both computers?
Try
#if defined SGI
.....
#elif defined LINUX
.....
#endif
if anything.
C and C++ are different languages and it is a Bad Idea to splice
the files together if they are in different languages.
If they are in the same language and are not completely different
(look, e.g. at "diff -u file.c file.C |less") then treat only
the different places differently with the help of conditional
compilation.
However, it is probably the best if you leave the whole thing
alone if you do not understand the issues involved.
-Michael
--
E-Mail: Mine is a gmx dot de address.