Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > How To Reduce Number Files by Putting file1.c and file2.C Together

Reply
Thread Tools

How To Reduce Number Files by Putting file1.c and file2.C Together

 
 
Christopher M. Lusardi
Guest
Posts: n/a
 
      11-16-2004
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.

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?

Thank you,
Christopher M. Lusardi
 
Reply With Quote
 
 
 
 
Michael Mair
Guest
Posts: n/a
 
      11-16-2004


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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Splitting an array into quads and putting them back together again. CBlair1986 Ruby 4 11-18-2006 09:11 AM
How To Reduce Number Files by Putting file1.c and file2.C Together Christopher M. Lusardi C++ 1 11-16-2004 12:38 PM
better to compress the jpeg or reduce resolution or reduce pixel size? Mr.Will Digital Photography 8 10-08-2004 03:16 PM
Difference between putting code in constructor and putting code in static{} Saurabh Java 6 05-30-2004 02:44 PM



Advertisments