Go Job Hunting at the LQ Job Marketplace
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 06-27-2003, 11:53 AM   #1
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 (,, 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.

Old 06-27-2003, 12:00 PM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971Reputation: 1971
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.
Old 06-28-2003, 10:53 AM   #3
Senior Member
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
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:
#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.


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

All times are GMT -5. The time now is 08:33 AM.

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