sy13220@fmrco (Richard J. Niziak) (09/30/90)
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 <stdio.h> #include <stdlib.h> Very confused.... Please help. uunet!uupsi!ontologic!rickn
subbarao@phoenix.Princeton.EDU (Kartik Subbarao) (10/02/90)
In article <1990Sep30.152249.15810@fmrco> sy13220@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 <stdio.h> >#include <stdlib.h> >Very confused.... >Please help. stdlib.h is an ANSI Cism. You can only use ANSI C if you have an ANSI C compiler (such as gcc). Once you are sure that your compiler indeed is an ANSI C compiler, you might want to take a look at /usr/include (or whatever is defined as the default include directory on your system) and see whether stdlib.h exists. If not, then you probably have to look at the compiler and see if it put the .h files anywhere else. If you are still confused, your best bet then is to contact your sysadmin about it... -Kartik (I need a new .signature -- any suggestions?) subbarao@{phoenix or gauguin}.Princeton.EDU -|Internet kartik@silvertone.Princeton.EDU (NeXT mail) -| SUBBARAO@PUCC.BITNET - Bitnet
zoo@grumpy.spa.umn.edu (david d [zoo] zuhn) (10/02/90)
>>>>> 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 <stdio.h> >#include <stdlib.h> >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
gwc@root.co.uk (Geoff Clare) (10/03/90)
sy13220@fmrco (Richard J. Niziak) wrote: >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. subbarao@phoenix.Princeton.EDU (Kartik Subbarao) replied: >stdlib.h is an ANSI Cism. You can only use ANSI C if you have an ANSI C >compiler (such as gcc). While these two statements of Kartik's are both true, the implication that you can only use stdlib.h if you have an ANSI 'C' compiler is not. All POSIX conformant systems provide stdlib.h regardless of whether they have a common 'C' or ANSI 'C' compiler. -- Geoff Clare <gwc@root.co.uk> (Dumb American mailers: ...!uunet!root.co.uk!gwc) UniSoft Limited, Hayne Street, London EC1A 9HH, England. Tel: +44-71-315-6600