On 5/24/07, engvishal_jain <[EMAIL PROTECTED]> wrote: > Hi All, > I am stuck with this simple code that uses #error > No exe is form and stupid gcc giving following error. > Pls help me out
What are you expecting? "Stupid" gcc is right in not generating an executable, because you tell it to fail with a fatal error. #error is for creating a _compile time_ fatal error. If you use it like this your program will never compile. See: http://www.delorie.com/gnu/docs/gcc/cpp_43.html If you want to print on stderr you can use fprintf (stderr, "Error message"); > ---------------------------------------------------------- > #include<stdio.h> > > int main(void) > { > printf("BUG :::::::::::::::::::: %s : %d",__FILE__,__LINE__); > #error "Failed to inialize" > return 0; > } > ---------------------------------------------------------- > OUTPUT > $ gcc a.c > a.c:6:10: #error "Failed to inialize" > a.c: In function `main': > a.c:4: warning: return type of `main' is not `int' > a.c:7:2: warning: no newline at end of file > ---------------------------------------------------------- -- Tamas Marki
