N
naunetr
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
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