473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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
Jul 22 '05 #1
1 1601


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.

Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: MJS | last post by:
I am new to perl and I need some help with the following problem. I have two files viz. file1 and file2. I have to determine if a scalar variable in file1 (without knowing its location) has a...
3
by: Kostadis.Spirou | last post by:
this is a programm that opens config.txt and reads the 2 lines that are inside it,after that it copies them and i want to put them as parametres at ifstream examplefile (file1.data()); ofstream...
1
by: Christopher M. Lusardi | last post by:
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...
2
by: Prashant Mahajan | last post by:
I just wanted comments from you all on the following topic: Let's say we have 2, C code files namely file1.c and file2.c. file1.c contains few pre-processor definations say #define TEST1 10 We...
6
by: Wescotte | last post by:
I'm having an issue where what should be global variables are not in scope and I'm confused as to why. In Case 1 the variables are not in scope for functions in File2 In Case 2 the varibales are...
5
by: ckoniecny | last post by:
I have the following two files: File1: 11 John Doe 33 Jane Doe 55 Steve Smith File2: 22 Joe Doe 44 Willy Widget
3
by: Klaas Vantournhout | last post by:
Hi, Recently I obtained a problem with virtual inheritance when implementing it in multiple files. To present the problem I have included at the bottom of this post the code of the 4 files. I...
2
by: santhoshs | last post by:
Hello I am required to parse two files that contain email addresses and figure out a way to get the matching and non-matching email addresses from both the files. I was able to get the matching...
3
by: Madhur | last post by:
I would like to know the best way of generating filter of two files based upon the following condition I have two files. Contents of the first file is File 1 abc def hij asd sss lmn hig pqr...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.