473,765 Members | 2,035 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1623


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
2791
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 certain value (say 10). If its true, then I have to add file2 to file1 at a certain location. So my question is how to do this and how to write at a certain location in file1.
3
1936
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 fout (file2.data()); but when i try to run it it doesn't work at all. any suggestions what to change in my code? #include <iostream>
1
361
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 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...
2
1624
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 now compile file1.c , make it's object file. and use this object file in the other file i.e file2.c. Then can we use the macro TEST1 in file2.c as well. As I understand about macros, they are replaced by their corresponding values , but are the...
6
1548
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 in scope for access in File1's functions AFTER the include In Case 3 the varibales are in scope for functionsin File2 Why does case 1 not work but case 3 does? Does case 2 the proper method
5
5870
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
2358
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 show results with the gnu compiler but i have the same results with the intel compiler. file1.cpp compiles without a problem, the problem occurs when compiling file2.cpp. It complains about not finding the constructor of the class base.
2
2119
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 entries by using the following code: #!/usr/bin/perl open f1,"file1" or die "cannot open file:$!\n"; open f2,"file2" or die "cannot open file2:$!\n"; open out,">match.out" or die $@; @file1=<f1>; @file2 =<f2>; close f1;close f2;
3
1316
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 mno
0
9568
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9399
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9957
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9835
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8832
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.