C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-12-2008, 03:31 AM   #1
Registered User
 
Join Date: Dec 2005
Posts: 82
Question gcc compiling and linking problem

Hi all,

I am facing a problem in creating an executable.

My code compiles fine but while linking with a static library it says undefined reference to "fuctionname".
Where as instead of creating executable if i am creating a shared library of it then it works fine (i don’t know it will run fine or not, but compiling and creation of .so goes fine).

Could you help me out of this problem?

I have heard that shared libraries are permitted to have undefined references. Is it true?

Thanks in advance.
__________________
S_cess is waiting for u. Go Ahead, put u there.
maven is offline   Reply With Quote
Old 11-12-2008, 03:47 AM   #2
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
A .so doesn't require all symbols to be resolved, so I'd guess that it simply hides the actual problem until you try to RUN the application that links to the .so.

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 11-12-2008, 04:31 AM   #3
Registered User
 
Join Date: Dec 2005
Posts: 82
ok, thanks for sharing the information.
I will run the application and see the possible results.

Any other information will also be appreciable.
__________________
S_cess is waiting for u. Go Ahead, put u there.
maven is offline   Reply With Quote
Old 11-12-2008, 04:53 AM   #4
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
It would also help if you let us know what the symbol that is undefined is. One of your symbols, something from the C library, or... ?

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 11-12-2008, 05:10 AM   #5
Registered User
 
Join Date: Dec 2005
Posts: 82
It is from some third party library.
I am trying to resolve, i will update you once i am done.
__________________
S_cess is waiting for u. Go Ahead, put u there.
maven is offline   Reply With Quote
Old 11-12-2008, 07:07 AM   #6
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
Quote:
Originally Posted by maven View Post
It is from some third party library.
I am trying to resolve, i will update you once i am done.
So maybe you need to link your library with that third party library?

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 11-14-2008, 05:28 AM   #7
Registered User
 
Join Date: Dec 2005
Posts: 82
It is solved.

I was compiling my code with the library only. But there were few conditional comiplation in libarary code, which needs to be configure in a header file. When i compiled the library code with proper configuration then it worked fine.

By the way, thanks a lot matsp for nice informations!
__________________
S_cess is waiting for u. Go Ahead, put u there.
maven is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Screwy Linker Error - VC2005 Tonto C++ Programming 5 06-19-2007 02:39 PM
Problem Compiling Flakster C++ Programming 4 06-13-2006 01:09 AM
Grrr.... SDL Linking Problem 7EVEN Game Programming 5 08-12-2005 08:44 PM
simple compiling problem waxydock C++ Programming 2 03-26-2005 10:33 AM
gcc 3.2 & linking rotis23 Linux Programming 1 06-23-2003 06:46 AM


All times are GMT -6. The time now is 05:39 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22