Re: gcc compilation problem with -ansi option,

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

 



On Mon, Dec 02, 2002 at 07:49:46PM +0530, Guruhema Prasad N wrote:
> Problem 1:-
> I am using option  "gcc -Wuninitialized -O -ansi", but its giving 
> undeclared variables for the math defines "M_PI" which is defined in 
> "/usr/include/math.h" file. If I remove "-ansi" option, its compiles 
> properly, but I want to use "-ansi" option., I need to add any other 
> options along with "-ansi"
> 
> Problem 2:-
> 
> Similarly, if I use "-ansi" option, I can't access the define "S_IFREG" 
> in file "/usr/include/sys/stat.h".
Short version: don't use -ansi if you don't know what C89 defines and
what not. 
1) M_PI is not part of ISO C89.
2) sys/stat.h, and therefore S_IFREG aren't part of ISO C89 either.
Both are defined by Single UNIX Specification, so if you insist on the
-ansi for whatever reason, you'll probably want to put
#define _XOPEN_SOURCE 600
at start of your source file (before the includes).
	Mirek



_______________________________________________
Redhat-devel-list mailing list
Redhat-devel-list@redhat.com
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux