Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tlug: Problems with libraries



--------------------------------------------------------
tlug note from "Andrew S. Howell" <andy@example.com>
--------------------------------------------------------
>>>>> "Alan" == Alan B Stone <stoneab@example.com> writes:


    Alan> I know I probaly asked this question before but....I lost
    Alan> most of my old emails recently when reloading the system.

    Alan> I'm trying to do some work for school with C++ and Motif.
    Alan> However, when I try to compile the programs I continually
    Alan> get errors stating that the included libs do not exists,
    Alan> which I know is not the case.  I have been using the
    Alan> following command line "g++ hello.C
    Alan> -l/usr/X11R6/include/Xm/Xm.h -l/usr/X11R6/include/Xm/Label.h

I think your confusing libraries and includes. The -l switch says
which libraries to use. For example: -lXt.a to link against
libXt.a. To tell the linker where to look for the libraries, use the
-L switch. In this case, it would most likely be -L/usr/X11R6/lib.

Now, for the include files ( .h ), you need to use
-I/usr/X11R6/include/Xm. Having said that, if you take a look at your
hello.C, you'll probably find that it has a line like:

#include "Xm/Xm.h"

In which case you would use -I/usr/X11R6/include, since the C
preprocesor will look for "Xm/Xm.h" in all the directories listed in
the -I options.

You might want to look at gnu info files for gcc and cpp. They are a
bit of a pain to navigate, but you should be able to find out how all
these options work. I you use emacs, you can access these from M-x
info, provided its been setup.

Hope this helps.

	Andy
-----------------------------------------------------------------
a word from the sponsor will appear below
-----------------------------------------------------------------
The TLUG mailing list is proudly sponsored by TWICS - Japan's First
Public-Access Internet System.  Now offering 20,000 yen/year flat
rate Internet access with no time charges.  Full line of corporate
Internet and intranet products are available.   info@example.com
Tel: 03-3351-5977   Fax: 03-3353-6096


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links