C for the compleat novice?

Gary S. Moss VLD/VMB <moss> moss at brl.mil
Tue Aug 14 23:22:51 AEST 1990


In article <25250.26c5cd90 at kuhub.cc.ukans.edu>,
arritt at 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.



More information about the Comp.sys.sgi mailing list