On Tue, Mar 25, 2008 at 2:31 PM, Randy Kramer <[EMAIL PROTECTED]> wrote:
> In my efforts to learn enough to possibly start developing folding for nedit,
> I'm trying to run some simple Motif tutorials by Marshall Brain. The first
> one is at:
>
> http://www-h.eng.cam.ac.uk/help/tpl/graphics/Motif/mt2
>
> I've done some googling, I have consulted what I thought was my best C
> reference ("C: A Reference Manual" by Harbison and Steele), but I'm just
> thoroughly discombombulated. Although this is probably not exactly the right
> mailing list for this (maybe I should try a C language list), I thought I'd
> try here anyway.
>
> I've described a lot of problems / questions here--an approach to address
> them
> one at a time would be peachy. ;-)
>
> (I'm trying to run these on lesstif because lesstif was partially installed
> on
> my Mandriva2006 system. I say partially because the devel part was not
> installed, and I've since installed it. I recognize that this may not be the
> best *tif for NEdit, but I'd like to get started with these simple tutorials
> which I believe should work with lesstif even though written for Motif. By
> the time I get ready to compile NEdit, I'd hope to have a different system
> installed (possibly Kubuntu with a bunch of development stuff loaded from
> Debian, if necessary).)
>
> Also note that the following are installed (iirc, the first three were
> installed, the 4th I installed recently--I *might* have also installed the
> libxorg-x11-devel recently):
> * libxorg-x11-6.9-1.cvs20050915.2mdk
> * libxorg-x11-devel-6.9-1.cvs20050915.2mdk
> * lesstif-0.93.94-4mdk
> * lesstif-devel-0.93.94-1mdk
>
> The command line recommended (in mt1):
>
> cc -o first first.c -lXm -lXt -lX11
>
> is not working.
>
> Early on, I had some errors related to the program not finding the include
> files:
>
> [EMAIL PROTECTED] lesstif-0.95.0]$ cd /rhk/X
> [EMAIL PROTECTED] X]$ ls
> motif_tut1.c
> [EMAIL PROTECTED] X]$ cc -o first motif_tut1.c -lXm -lXt -lX11
> motif_tut1.c:1:19: error: Xm/Xm.h: No such file or directory
> motif_tut1.c:2:22: error: Xm/Label.h: No such file or directory
>
> So I started running the program from the directory "above" those include
> files, like after:
>
> [EMAIL PROTECTED] X]$ cd /usr/X11R6/
> [EMAIL PROTECTED] include]$ cd Xm
>
> but that didn't help.
>
> Finally I added a -I directive to the command line:
>
> [EMAIL PROTECTED] Xm]# cc -o first /rhk/X/motif_tut1.c -lXm -lXt -lX11
> -I /usr/X11R6/include/
> /usr/bin/ld: cannot find -lXm
> collect2: ld returned 1 exit status
>
> That seemed to solve the include file problem, because next I started getting
> errors related to the parts of the command like -lXm (see above).
>
> Digression: General questions on what's happened so far:
>
> * Should I have to include a -I directive or is there something I'm missing
> from my setup?
That -I is right, you can than run cc in your /rhk/X dir again
>
> * Somewhere I read about the "standard locations" for include files (found
> by the include <file> syntax vs. the include "file" syntax). What are those
> standard file locations (on a Linux (Mandriva2006) system)?
Not that much, but these should be in:
/usr/include
/usr/local/include
>
> * Can I specify those standard locations with an environment variable or
> similar? (I saw that there was such a variable for a MS Dos-based system.)
Don't know, but -I is all what you need.
>
> * What is the right thing to do?
-I/usr/X11R6/include/
>
> Now back to the -lXm problem--repeating the previous trial:
>
> [EMAIL PROTECTED] Xm]# cc -o first /rhk/X/motif_tut1.c -lXm -lXt -lX11
> -I /usr/X11R6/include/
> /usr/bin/ld: cannot find -lXm
> collect2: ld returned 1 exit status
>
> At this point, I tried things like running the program from one level above
> where I was (oh, I also started running the command as root, because I was
> running from /usr/X11R6/Xm, but I'm fairly certain I shouldn't have to
> normally run as root--because I wasn't root, I got:)
This 'running from one directory above' changes nothing.
>
> /usr/bin/ld: cannot open output file first: Permission denied
> collect2: ld returned 1 exit status
>
> Anyway, running from the /usr/X11R6 or the /usr/X11R6/Xm directories didn't
> help.
>
> I do see directories Xm and X11 in /usr/X11R6.
>
> I've tried things like replacing the -lXm with the complete path to Xm, like
> -l/usr/X11R6/Xm.
>
> Also, although I see libXt:
>
> /usr/X11R6/lib/libXt.so.6
>
> I don't see a directory Xt.
>
> (Although this is a problem, I don't think it's the only problem or the
> problem blocking progress, as even though Xm and X11 seem to be installed, I
> can't get the -lXm or -lX11 "commands" to work.)
>
> What do I have to do to get -lXm and -lX11 to work? Must I run from a
> specific location, or set an environment variable, or what?
>
> What do I have to install to get Xt? (I do see the man pages and HTML pages
> for Xt installed, I'm almost thinking there is something missing from the
> Mandriva2006 install.)
>
> I've done some googling, I have consulted what I thought was my best C
> reference ("C: A Reference Manual" by Harbison and Steele), but I'm just
> thoroughly discombombulated.
>
> Although I've described a lot of problems / questions here, an approach to
> address them one at a time would be peachy. ;-)
With the -l option, you give the linker (which is invoked by cc) a
library that this binary need. the part after the '-l' is the name
(for example Xm). The file name of this library is than libXm, plus an
appropriate ending (either .a for a static, or .so for a dynamic
library, but this isn't important now, lets say .so). you will
probably find this file in the directory /usr/X11R6/lib. Now comes a
new option: -L, wich is like -I, but gives a search path for libraries
and not include files, so all you need is to add -L/usr/X11R6/lib to
your cc command, and it should work
Bert
>
> Thanks,
> Randy Kramer
--
NEdit Develop mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/develop