LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 06-27-2003, 10:53 AM   #1
dim79
LQ Newbie
 
Registered: Jun 2003
Posts: 2

Rep: Reputation: 0
Question Linker Error


Hello Friends,

I m facing problem while running Kylix Application
Following are the details:

I had downloaded Speex (Audio Codec) Library and installed it on my Linux (RedHat 7.2) machine.It got installed properly and library files (libspeex.so, libspeex.so.1, libspeex.so.1.0.0) got installed in /usr/lib directory. Now i had specified all include nd library paths in Kylix. When i use "speex.h" (part of speex audio codec library) in my source code then my program gets complied successfully. But when i run the same program i get linker error exception as follows


[linker error] Unresolved external 'speex_bits_init' referenced from xyz.o


Here xyz.o is one of my project file and 'speex_bits_init' is a function (part of speex library) and i using many other functions like this from same library. Now i guess problem is Kylix is unable to load the speex library. I also tried setting environment variables like LD_LIBRARY_PATH etc. Still facing problem with linker error.

Can anyone help me out and let me know how to solve this linker error problem. I would be greateful to you.

Thanx in advance.

dim79
 
Old 06-27-2003, 11:00 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

http://www.linuxquestions.org/rules.php
 
Old 06-28-2003, 09:53 AM   #3
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
I don't have the greatest experience with linking to external libraries, but I'll give it a shot. From what I understand, setting LD_LIBRARY_PATH does not help except at runtime. You must manually tell the compiler to link the library in at compile-time. Take the math library for instance. Suppose I this source file:
Code:
#include <stdio.h>
#include <math.h>

int main()
{
  double value;
  double square_root;


  value = 16.0;

  square_root = sqrt(value);

  printf("The square root is: %f\n", value);
}
This command results in:
$ gcc -o do_sqrt do_sqrt.c
/tmp/ccmTGmHd.o: In function `main':
/tmp/ccmTGmHd.o(.text+0x28): undefined reference to `sqrt'
collect2: ld returned 1 exit status
$

Until I give the compiler the '-lm' command to link in the math library, it won't work. Similarly, I imagine you'll have to do something like:

gcc -o my_app -lspeex my_app.c

Again, I may be way off base, but that would seem logical to me.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
linker error pavan Programming 2 10-06-2005 01:58 AM
ld linker error Ankit mittal Programming 2 09-30-2005 07:40 AM
gcc Linker error - please help! Liche Programming 5 09-26-2005 07:14 AM
Linker error eddydw Linux - General 0 09-20-2004 01:21 PM
linker error Config Programming 8 06-04-2002 03:33 AM


All times are GMT -5. The time now is 10:14 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration