conditional compile...
- From: naunetr <naunetr@xxxxxxxxx>
- Date: Fri, 30 Nov 2007 19:57:40 +0530
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.
also why is compiler printing error twice. it looks ugly. is there a way to make it print error once only?
thanks.
code:
/* #define MYSYMBOL 1 */
#if MYSYMBOL != 1
#error "Error"
#else
#include <stdio.h>
main() { puts("hello"); }
#endif
.
- Follow-Ups:
- Re: conditional compile...
- From: Chris Dollin
- Re: conditional compile...
- Prev by Date: Re: make & nmake, cl & gcc
- Next by Date: Re: memcat fn
- Previous by thread: library function vs system calls
- Next by thread: Re: conditional compile...
- Index(es):
Relevant Pages
|