On Mon, Sep 25, 2000 at 08:18:45AM +1100, Nick Croft wrote:
>
> I seemed to be missing the *.a files - so I copied them over from my RH
> install on the other disk. 
> 
> gtk+ compiled OK after that, and appeared to install as well, although
> when I went to make an example, gcc couldn't find gtk-config. So I
> manually installed that in /usr/bin.

As an aside, if you're simply trying to set up an environment to do
gtk+ coding in I'd suggest you simply install the gtk+-devel package,
rather than compiling from source.

> Now gcc tries, but reports back:

[I assume now this when compiling your own program, which links against
gtk]

> /usr/bin/ld cannot find -lgtk
> collect2: ld returned 1 exit status
> make: *** [buttons] Error 1
> 
> I can't find -lgtk either, although if that means gtk/gtk.h I've also made
> sure that's in lib.
> 
> I tried adding -L /usr/include/gtk   as well as
>                -L /home/me/coding/gtkStuff/gtk+-1.2.8/gtk 
> to no effect.   

(The three stages of building your program are preprocessing,
compiling, and linking.)

/usr/include contains header files (such as <gtk/gtk.h>), used in
preprocessing. To specify a directory to find header files in, use
the -I (capital i) flag.

The -L and -l (lower case L) flags apply to the linking stage.

Your compilation actually gets to the linking stage (it attempts
to invoke the linker (/usr/bin/ld -- invoked by gcc) which then gives
the first error above) so it's not a problem with the header files.
The problem is that it can't find the gtk library (it is attempting
to link the precompiled code in the libraries in to your program).

you need to make sure the gtk library exists (eg. in /usr/lib).
Libraries have the form "*.a" for static libraries and "*.so*" for
shared libraries. eg. check that /usr/lib/libgtk.a or
/usr/local/lib/libgtk.a exists (depending on where you installed
gtk). The flag "-lgtk" instructs the linker to try to find a file
called "libgtk.a" in any of the library directories it knows about.

> I've tried updatedb and ldconfig as well.

updatedb is only used for the 'locate' database, which isn't used in
building programs.

ldconfig is used for updating links to shared libraries and priming
the dynamic linker's cache. They dynamic linker (man ld.so) is used
when running programs, but usually not when building them.

> I may have to get dselect out again and make sure I've got various
> development libs. Or go back to my rh install if I want to use gtk+.

both are good ideas, but fix your gcc flags up first. Don't let
packaging problems get in the way of a good day's coding :)

Conrad.


--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to