C tutorials

Lachlan Cranswick lachlan at ldeo.columbia.edu
Thu Apr 12 01:44:01 BST 2001


>On Wed, Apr 11, 2001 at 09:07:43PM +0100, Ben Paley wrote:
>> On Tue, 10 Apr 2001, you wrote:
>> <snip>
>> > Once you're comfortable with the basics of C, I reccomend ploughing
>> > through the comp.lang.c FAQ sometime.  It's a mine of information that
>> > other people have found out about the hard way.
>> <snip>
>> 
>> Thanks a lot, I'll check that stuff out. I managed to find a reasonable gtk+
>> tutorial (which assumes a little more c knowledge than I have) at
>> http://www.gtk.org/tutorial (the obvious place!), now if only I can get
gcc to
>> find the gtk libraries... 
>
>One hint, which I would have much appreciated when I was starting out is
>that the libraries go at the end of the command line.  F'rinstance:
>
>% gcc -o gtkprog gtkprog.o -L/usr/X11R6/lib -lgtk
>
>The -L flag says where to look for libraries, the -l says which
>libraries to link in.  The -L can go anywhere on the command line, but
>the -l *must* come after everything else.  And if you have multiple
>libraries to link in, they frequently have to be given in the right
>order as well.  Beware.

Not being a programmer person I am not sure of the why and wherefores but
the -I option may have to be explicitely mentioned (this can be something
to find out due to random mucking about)  On SGI IRIX both the relevant
directory areas for -I and -L are found by default:

e.g.,

on SGI IRIX:
  f77 -o platon platon.f xdrvr.c -lX11

On Redhat Linux with g77 installed:
  f77 -o platon platon.f xdrvr.c -L /usr/X11R6/lib -lX11 

On FreeBSD with EGCS gcc installed:

 g77 -o platon platon.f xdrvr.c -I/usr/X11R6/include -L /usr/X11R6/lib -lX11

On FreeBSD with default f2c based f77
  f77 -NL400 -Nn802 -Nx800 -o platon platon.f xdrvr.c -I/usr/X11R6/include
-L /usr/X11R6/lib -lX11


Lachlan.

-----------------------
Lachlan M. D. Cranswick
Geochemistry - Lamont-Doherty Earth Observatory, Columbia University
PO Box 1000, 61 Route 9W Palisades, New York 10964-1000 USA
Tel:  (845) 365-8662   Fax:  (845) 365-8155 
E-mail: lachlan at ldeo.columbia.edu  WWW: http://www.ldeo.columbia.edu
       CCP14 Xtal Software Website: http://www.ccp14.ac.uk






More information about the Ukfreebsd mailing list