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

Compiling Error



The following reports an error during compiling:

------------------------------------------------------
#include <stdio.h>

FILE *output=stderr;

int main()
{
  fprintf(output,"Hello World\n");
}
------------------------------------------------------

The problem is that its not possible to initialize output with stderr
because it is not a constant. Is there any solution to this without
modification of the code, only with gcc options.

The following modification is obvius and Iam not interested in it.

--------------------------------------------------------------
#include <stdio.h>

FILE *output;

int main()
{
   output=stderr;
   fprintf(output,"Hello World\n");
}
---------------------------------------------------------------


Under UNIX Systems I got not problem with this code but under Linux, gcc
(ver 2.7) Distribution RedHat this code reports an error. 

Thank you.


Reply to: