LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 01-24-2006, 02:47 AM   #1
enemorales
Member
 
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...

THANK YOU A LOT IN ADVANCE FOR ANY FEEDBACK!
 
Old 01-24-2006, 08:39 AM   #2
bigearsbilly
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 08:42 AM.
 
Old 01-24-2006, 09:08 AM   #3
enemorales
Member
 
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410

Original Poster
Rep: Reputation: 31
Hi!

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

Thanks!
 
Old 01-24-2006, 09:19 AM   #4
enemorales
Member
 
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:

Code:
In function `CPXPloadcclass': undefined reference to `__ctype_b'.
I've found this: (http://www.linuxbase.org/spec/refspe...--ctype-b.html)

Code:
__ctype_b
Name
__ctype_b -- array index for ctype functions
Synopsis

#include <ctype.h>

extern const unsigned short int *ctype_b;

Description

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


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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:50 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration