Re: FILE *foo = stderr; ==>`initializer element is not constant'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richie Baldwin <baldwinr@xxxxxxxxxxxxxx> writes:

> When trying to compile a c file using stderr, I have the declaration:
> FILE *foo = stderr;
> and it keeps giving me "Initializer element is not constant". I was
> wondering what could be done to preven this error from happening.
> I'm not sure if this is incorrect code or what, but any help would be
> appreciated.
> 
> The file is a short one, it is:
> #include <stdio.h>
> FILE *foo = stderr;
> 
> and it gives me the error on line 2.
> 
> Any assistance that you all could provide would be greatly appreciated.
> Richard Baldwin.

This is an issue with the system library, not with the compiler.  The
<stdio.h> file provided by the system library is providing a
definition of stderr which is not a constant.  This is permitted by
the C standard, so your program is not highly portable.  You neglected
to see which system you are using, so it is difficult to say anything
more precise.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux