arritt@kuhub.cc.ukans.edu (08/13/90)
I've been trying to take advantage of the large amount of software that is available in public domain. Binaries for the 4D seem to work ok, but I can *never, ever* get C source code to compile. This even includes code obtained from SGI via this newsgroup. What I'm wondering is -- do you need to "set up" your system to compile C code? I don't know anything at all about C; I program in [asbestos suit on] Fortran [asbestos suit off] and besides am more of an end-user than a programmer anyway. Should you not really expect C source code to work without some tweaking? Is C inherently non-portable? Recent example: I tried to get a .gif viewer to compile and obtained the following error output. cc -O -c xgif.c cpp: error /usr/include/X11/Xos.h:69: Can't find include file strings.h cpp: error /usr/include/bsd/sys/ioctl.h:9: Can't find include file net/soioctl.h cpp: error /usr/include/bsd/sys/ioctl.h:10: Can't find include file sys/ttychars.h *** Error code 1 Stop. Now, I guessed it was trying to find the files ending in .h, but thought they weren't on the system. I did a "find" for each file and obtained the following results: /usr/include/bsd/net/soioctl.h /usr/include/bsd/strings.h /usr/include/bsd/sys/ttychars.h So each of these files is on my system, but apparently the C compiler is getting confused? Is there any simple way around these problems? Should I just give up, unless I can somehow find the time to learn a new computer language? :-( Whatever help you can give would be most appreciated. P.S. my system is a 4D/25G running IRIX 3.2 ________________________________________________________________________ Ray Arritt | Dept. of Physics and Astronomy | Univ. of Kansas | Lawrence, KS 66045 | arritt@kuhub.cc.ukans.edu | arritt@ukanvax.bitnet |
moss@brl.mil (Gary S. Moss (VLD/VMB) <moss>) (08/14/90)
In article <25250.26c5cd90@kuhub.cc.ukans.edu>, arritt@kuhub.cc.ukans.edu writes: |> What I'm wondering is -- do you need to "set up" your system to compile C |> code? No, assuming you have a C compiler properly installed. |> I don't know anything at all about C; I program in [asbestos suit on] |> Fortran [asbestos suit off] and besides am more of an end-user than a |> programmer anyway. Should you not really expect C source code to work |> without some tweaking? Is C inherently non-portable? C is just a language, portability is a separate discipline. Neither have much to do with your problem, so let's not generalize [else I have some things to say about Fortran programmers ;-b]. |> cc -O -c xgif.c |> cpp: error /usr/include/X11/Xos.h:69: Can't find include file strings.h |> cpp: error /usr/include/bsd/sys/ioctl.h:9: Can't find include file net/soioctl.h |> cpp: error /usr/include/bsd/sys/ioctl.h:10: Can't find include file sys/ttychars.h |> |> Now, I guessed it was trying to find the files ending in .h, but thought they |> weren't on the system. I did a "find" for each file and obtained the |> following results: |> |> /usr/include/bsd/net/soioctl.h |> /usr/include/bsd/strings.h |> /usr/include/bsd/sys/ttychars.h |> See, the problem is staring you right in the face! You need to search /usr/include/bsd for these files; by default, the C preprocessor (cpp) looks in /usr/include. Specify other directories with the -I compile flag (see the "cc" manual page for details). cc -O -c -I/usr/include/bsd xgif.c You will probably also need to use the -lbsd loader directive. These are best placed in the Makefile. If you are using "imake", you probably aren't using it properly, or your system-specific config file is not right. These flags are necessary for compatability between Berkeley and AT&T style UNIX implementations and this type of usage is very common these days; not all portability can be achieved in the C source, the Makefile has to do its part to pull in the correct libraries and find the correct include files. Make sure you remove any .o files before you recompile with the -I switch. |> Is there any simple way around these problems? Should I just give up, |> unless I can somehow find the time to learn a new computer language? :-( |> Whatever help you can give would be most appreciated. You were almost there, your just too paranoid about C to see it.