Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: cannot compile same code on RHL 7.2 and 9.0

Thread Tools

Re: cannot compile same code on RHL 7.2 and 9.0

Derk Gwen
Posts: n/a
"Slavisa" <(E-Mail Removed)> wrote:
# Yes, i have. Why ? Is that the problem ? Thats strange.

# > Do you have a header file that ends in something like
# > #endif
# > without a new line after the #endif or some other final preprocessor
# command?

Depending on the compiler, if there is no end of line at the end of an included
file, the preprocessor paste the last line onto the front of the next line of
the including file.

If you have something like
#include "beta.h"
#include "gamma.h"
int omega(void) {...}<<EOF>>
#ifndef beta_h
#define beta_h
int upsilon(void) {...}
int zeta(void) {...}<<EOF>>

Then on some systems, this is pasted into a source

#ifndef beta_h
#define beta_h
int upsilon(void) {...}
#endif int zeta(void) {...} int omega(void) {...}<<EOF>>

Pasting int zeta... and int omega... onto one line is not a problem, because
new lines are no more signficant than blanks to the compiler, but they are
special for preprocessor instructions: pasting the C functions onto the same
line as a preprocessor line can have all sorts of adverse effects.

The problem could be something else of course, but I usually see these
kinds of errors in this case, or in case of an omitted semicolon (.

Derk Gwen
Haven't you ever heard the customer is always right?
Reply With Quote
Joona I Palaste
Posts: n/a
Nils Petter Vaskinn <(E-Mail Removed)> scribbled the following:
> On Tue, 12 Aug 2003 00:18:57 +0000, Derk Gwen wrote:
>> ------------alpha.c
>> #include "beta.h"
>> #include "gamma.h"
>> int omega(void) {...}<<EOF>>
>> ------------beta.h
>> #ifndef beta_h
>> #define beta_h
>> int upsilon(void) {...}
>> #endif<<EOF>>
>> ------------gamma.h
>> int zeta(void) {...}<<EOF>>

> alpha, beta, gamma, epsilon .....

> whatever happened to foo, bar and baz? I thought they where the
> accepted names

> Any day now people are gonna start renaming i to loop_var and n to count,
> we're doomed I say, doomed.

I normally use foo and bar, but if I know I'm going to use exactly
four names, I use om, mane, padme and hum. I once used the variable
name janisistuimaassatorkkuentorkkuen in a Pascal homework program.

/-- Joona Palaste ((E-Mail Removed)) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"C++. C++ run. Run, ++, run."
- JIPsoft
Reply With Quote

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
Weird issue, same code, same browser, two different apache servers,very different css bluebaron HTML 3 11-04-2009 07:13 PM
How to compile the following source code in VC6// I have error inVC++6 but compile ok in GCC fAnSKyer C++ 2 06-07-2009 07:57 AM
cant compile on linux system.cant compile on cant compile onlinux system. Nagaraj C++ 1 03-01-2007 11:18 AM
cannot compile the following example code (person-pointer) =?ISO-8859-1?Q?Martin_J=F8rgensen?= C++ 26 03-31-2006 09:41 AM
cannot compile same code on RHL 7.2 and 9.0 Slavisa C Programming 1 08-11-2003 08:59 PM