Bert, 

Wonderful, thanks--it works!

Randy Kramer

PS: Ignore all of the following, it's just me trying to summarize where I am 
(and adding some notes about ldconfig and /etc/ld.so.conf and a problem the 
first time I ran first as myself).

The command line that worked: 

cc -o first /rhk/X/motif_tut1.c -lXm -lXt -lX11 -I /usr/X11R6/include/ 
-L/usr/X11R6/lib

(And now I can adjust that to compile and run anywhere (adding paths to the 
file name, or moving back to /rhk/X) and not as root.)  (Aside: At first I 
thought I had a problem in that when I ran ./first as myself, the window with 
"hello" didn't pop up.  Then I switched to root and it worked fine.  Then I 
switched back to myself and it worked.  Who knows--for now it seems to be 
working--if I run into a problem in the future, I'll figure it out or ask a 
question.)

In my earlier post, I forgot to mention that I had added some lines 
to /etc/ld.so.conf and then run ldconfig, but that didn't seem to help.  The 
current content of /etc/ld.so.conf is:

include ld.so.conf.d/*.conf
/usr/X11R6/lib
/usr/lib/qt3/lib
/usr/X11R6/include/Xm
/usr/X11R6/include/X11
/usr/X11R6/include

I added the last three lines, but since, afaict, they had no effect, I will 
delete those and try the cc command again (just to confirm that my changes 
were unnecessary).  Yup, deleted those lines and ran ldconfig again, the cc 
command still works.

But, oops, small (??) problem--if I run ./first as myself, it seems to run, 
but the window with hello doesn't pop up.  If I run ./first as root, the 
window pops up.  A quick look at the permissions doesn't tell me anything 
useful, the file is executable by everyone (755 permissions) (and owned by 
me).  

For now, I won't worry about this--well, OK, maybe I'll move this back to the 
non-ignore part of the post and see if Bert or someone else can tell me the 
problem.

On Tuesday 25 March 2008 09:53 am, Bert Wesarg wrote:
> On Tue, Mar 25, 2008 at 2:31 PM, Randy Kramer <[EMAIL PROTECTED]> wrote:
> >    * 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

I guess I could think about including a link in one of those 
to /usr/X11R6/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/

> >  At this point, I tried things like running the program from one level 
above
> This 'running from one directory above' changes nothing.

> >  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

Good stuff to remember:

   * library named Xm is in file libXm
   * .so is dynamic library, .a is static library
  * and, of course, the -L for search path for libraries

I should write to Marshall Brain and mention these problems and the solutions 
(or basically send him a copy of this email).


-- 
NEdit Develop mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/develop

Reply via email to