LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-06-2004, 07:13 PM   #1
yaotz
LQ Newbie
 
Registered: Apr 2004
Posts: 4

Rep: Reputation: 0
Question problem on linking Xm Xt X11 libraries


Hi all,
I've got a problem when I tried to compile (or link) some files with Xm, Xt and X11 libraries under Redhat9.0. The command I use is:

gcc filename.o -lXm -lXt -lX11 -lm

The error message is "Can't find Xm". Is it due to absence of these library files in my linux system? Can I install it?

Thanks
 
Old 04-06-2004, 08:15 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Sure can install them - RH comes with all
the XFree stuff you'll ever need... :}


Cheers,
Tink
 
Old 04-07-2004, 01:24 AM   #3
yaotz
LQ Newbie
 
Registered: Apr 2004
Posts: 4

Original Poster
Rep: Reputation: 0
I install almost all the packages, but it still does not work. The error message is exact like "/usr/bin/ld: cannot find -lXm". Is there any suggestion on which package I should install or I could download it somewhere?

Thanks

Last edited by yaotz; 04-07-2004 at 01:30 AM.
 
Old 04-07-2004, 04:24 AM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Fist try to locate them, see whether they're there
at all, and just in a non-standard place (or you
just didn't give the compiler a pointer as for
where to find them ... ).


Try
locate libXdm

If it finds some files add
-L <their/path> to your compiler call


Cheers,
Tink
 
Old 02-16-2005, 01:21 AM   #5
johnhardey
LQ Newbie
 
Registered: Feb 2005
Posts: 4

Rep: Reputation: 0
I know this post is very very old but I'm having the same problem as the original poster, so instead of starting a new thread, I'll revive this one.

As I said before, I got the same problem. It's my first program in GCC with X Windows.

I compiled my code with this:
gcc HelloWorld.c -o HelloWorld -lXm -lXt -lX11

same as the original poster used.

I got the same error.
/usr/bin/ld: cannot find -lXm
collect2: ld returned 1 exit status

So I compiled it with the path from:
locate libXdm
which is:
/usr/X11R6/lib/libXdmcp.a

So I compiled the code with:
gcc HelloWorld.c -o HelloWorld -l/usr/X11R6/lib/libXdmcp.a -lXm -lXt -lX11

but the same error occured:
/usr/bin/ld: cannot find -l/usr/X11R6/lib/libXdmcp.a
collect2: ld returned 1 exit status

What am I doing wrong? I'm using Fedora Core 3. I searched for the Xm, Xt and X11 folder in my computer using whereis. I did get the paths except for Xt but when I compile the problem started with Xm not Xt. The Xm and X11 folders do contain some files.

Please help.

*Cheers
 
Old 02-17-2005, 05:42 AM   #6
yaotz
LQ Newbie
 
Registered: Apr 2004
Posts: 4

Original Poster
Rep: Reputation: 0
My problem was solved by the exact following statement, "-L/usr/X11R6/lib -lXm -lXt -lX11 -lm"

Good luck!
 
Old 02-17-2005, 05:46 AM   #7
kevin_hill54
LQ Newbie
 
Registered: Jan 2005
Location: Australia
Distribution: fedore 3
Posts: 17

Rep: Reputation: 0
What is a compiler call and how do you create / do one??
 
Old 02-17-2005, 05:52 AM   #8
__J
Senior Member
 
Registered: Dec 2004
Distribution: Slackware, ROCK
Posts: 1,973

Rep: Reputation: 46
be more specific on "compiler call"
 
Old 03-07-2005, 09:46 AM   #9
yaotz
LQ Newbie
 
Registered: Apr 2004
Posts: 4

Original Poster
Rep: Reputation: 0
The following one is the problem one,
gcc filename.o -lXm -lXt -lX11 -lm
Then change it to,
gcc filename.o -L/usr/X11R6/lib -lXm -lXt -lX11 -lm
Everything works!

I compile it under RedHat7.0.
 
Old 03-07-2005, 11:03 AM   #10
__J
Senior Member
 
Registered: Dec 2004
Distribution: Slackware, ROCK
Posts: 1,973

Rep: Reputation: 46
is /usr/X11R6/lib in /etc/ld.so.conf and have you run ldconfig?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking old libraries to new one? winterhunter Linux - Software 7 10-24-2005 04:37 AM
Problem with linking libraries using gcc shortyzms Linux - Software 1 03-29-2004 08:13 PM
Shared libraries and linking., devin Programming 3 04-08-2003 03:18 PM
Linking to shared libraries? Griffon26 Programming 1 10-20-2001 05:29 PM
linking with shared libraries kobilevi Programming 0 03-01-2001 10:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration