Download your favorite Linux distribution at LQ ISO.
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 01-24-2006, 01:47 AM   #1
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410

Rep: Reputation: 31
Linking to a static library gives unresolved symbol

Hi there,

I got a static library that I need to use, but the linking process fails due to an unresolved symbol, that I do not use directly on my code, but it used in the library.

I've looked for solutions on the internet, and a couple of guys suggest that it is because the library was linked with an older (unknown) version of gcc. Is this possible? If that's the case. Is there a flag or parameter to give to gcc (I've 3.4) in order to compile this, or it is easier to guess (or find out) the version of gcc that was used to compile the library and then download that version, compile it, and use that (at least I guess that compiling gcc may not be a piece of cake)?

Could be another think that is not working? Unfortunately I have not the exact error at hand, but certainly I could post it if you think it may help to find a solution. Anyway, the library is a propietary library from the CPLEX solver version 7.5...

Old 01-24-2006, 07:39 AM   #2
Senior Member
Registered: Mar 2004
Location: england
Distribution: Debian, Mint, Puppy, Raspbian
Posts: 3,421

Rep: Reputation: 200Reputation: 200Reputation: 200
what are your -l link options?

Remember, linking is dependent on the order
in which libraries are linked
if they are interdependent.
Get the order wrong and they won't link.

The linker (I think) goes right to left and the libraries must be in the correct order.

try changing the order in your make file.

edit: also have you tried using nm to see if the symbol is on the library?

Last edited by bigearsbilly; 01-24-2006 at 07:42 AM.
Old 01-24-2006, 08:08 AM   #3
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410

Original Poster
Rep: Reputation: 31

In fact, I'm using a Makefile that comes with the library to compile one of the examples, so the options should be ok. I'll check things with "nm".

Old 01-24-2006, 08:19 AM   #4
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410

Original Poster
Rep: Reputation: 31
Ok, nm over the libs gives me many lines sayin "U __ctype_b". The error I get when linking is:

In function `CPXPloadcclass': undefined reference to `__ctype_b'.
I've found this: (

__ctype_b -- array index for ctype functions

#include <ctype.h>

extern const unsigned short int *ctype_b;


__ctype_b is an array index for ctype functions.

__ctype_b is not in the source standard; it is only in the binary standard.
I do not know what this means . The header file is included in the example I'm compiling.


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
unresolved symbol haddon Linux - Hardware 3 03-11-2005 02:24 PM
Unresolved symbol? Elonch Programming 2 03-01-2005 11:48 PM
Cannot find symbol, which is in static library, in a exe file. amumu Programming 0 02-03-2005 10:47 PM
static linking to c library lantern Programming 1 04-19-2004 08:58 AM
unresolved symbol gameport_register_port amea Linux - Newbie 1 04-15-2004 03:16 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:58 PM.

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