Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!decwrl!shelby!msi-s0.msi.umn.edu!aps1.spa.umn.edu!zoo From: zoo@grumpy.spa.umn.edu (david d [zoo] zuhn) Newsgroups: comp.unix.internals Subject: Re: Using sdtlib.h on a Sun system Message-ID: Date: 2 Oct 90 04:05:59 GMT References: <1990Sep30.152249.15810@fmrco> <2984@idunno.Princeton.EDU> Sender: news@msi.umn.edu Organization: Minnesota Automated Plate Scanner Project Lines: 47 In-Reply-To: subbarao@phoenix.Princeton.EDU's message of 1 Oct 90 21:58:18 GMT >>>>> On 1 Oct 90 21:58:18 GMT, Kartik Subbarao said: Kartik> In article <1990Sep30.152249.15810@fmrco> Richard J. Niziak writes: >I am fairly new to 'C' and am trying to complie a simple intro >program on my Sun 4/370. I use two include headers, stdio.h and stdlib.h >And when the complie goes through, it cannot find stdlib.h. >I have the entries in the program like this: >#include >#include >Very confused.... >Please help. Kartik> stdlib.h is an ANSI Cism. You can only use ANSI C if you have Kartik> an ANSI C compiler (such as gcc). Once you are sure that your Kartik> compiler indeed is an ANSI C compiler, you might want to take Kartik> a look at /usr/include (or whatever is defined as the default Kartik> include directory on your system) and see whether stdlib.h Kartik> exists. If not, then you probably have to look at the compiler Kartik> and see if it put the .h files anywhere else. If you are still Kartik> confused, your best bet then is to contact your sysadmin about Kartik> it... Actually, the more correct statement is that you can write ANSI style code if your compiler supports it (like gcc does), but you cannot write ANSI C code unless your library conforms to the standard. SunOS prior to 4.1 had very little that was done to be compatible with draft versions of the standard. Now that it is truly a standard, they have some ANSI'isms available (stdlib.h exists on my SS1 running 4.1). Sun still does not have a compiler that will support ANSI style code however, so they haven't done everything needed to support an ANSI C library (e.g. malloc still returns char*). I have heard that the next release of their product C compiler will support some ANSI features (such as function prototypes), but the current suite of compilers don't. This is why I use gcc on all the Unix boxes that I use. The GNU project is currently working on a C library that conforms to the ANSI standard, POSIX interfaces, as well as maintaining BSD and SysV compatibility. No, don't ask when this will be released, it's not ready yet. Until either FSF or Sun released an ANSI C library, you're hosed. You can sort of do okay by SunOS 4.1, but not fully. david d [zoo] zuhn Univ. of Minnesota Dept. of Astronomy zoo@aps1.spa.umn.edu Automated Plate Scanner Project