Re: conditional compile...



naunetr wrote:

hello all,

i wrote the small program below to practice conditional compiling. if i
define MYSYMBOL then everthing works fine, but when i comment MYSYMBOL
gcc gives the following message:
cnd_compile01.c:4:2: error: #error "Error"
cnd_compile01.c:1: warning: ISO C forbids an empty source file

i cant understand the warning and how to eliminate it? i tried placing
some dummy comment but still the same warning.

You need real code. A static declaration will do; comments won't.

also why is compiler printing error twice. it looks ugly. is there a
way to make it print error once only?

Pass [1]. But who cares? The way to stop it printing `error` twice is to
stop it printing `error` at all. If there's a real error error, the
repeated text is likely to be the least of your problems.

[1] If there is, it will be compiler specific. gcc has many many command-
line options, many of which control diagnostic reports.

--
Chris "it was deliberate" Dollin

Hewlett-Packard Limited Cain Road, Bracknell, registered no:
registered office: Berks RG12 1HN 690597 England

.



Relevant Pages

  • Re: conditional compile...
    ... i wrote the small program below to practice conditional compiling. ... define MYSYMBOL then everthing works fine, ... gcc gives the following message: ... some dummy comment but still the same warning. ...
    (comp.lang.c)
  • conditional compile...
    ... i wrote the small program below to practice conditional compiling. ... if i define MYSYMBOL then everthing works fine, but when i comment MYSYMBOL gcc gives the following message: ... i tried placing some dummy comment but still the same warning. ... also why is compiler printing error twice. ...
    (comp.lang.c)