undefined symbol

Vu Pham vu@sivell.com
Wed May 23 05:18:00 GMT 2001


Puneet Singhal wrote:
> 
> Hi all
> 
> I have a typical UNDEFINED SYMBOL prob over here. Here is the situation:
> 
> 1. I have a cpp proggy calling a function not defined locally called
> connect_oracle.
> 2. When I do nm of the .o file of this .cpp file, the name of the symbol I
> get is
>    connect_oracle__Fv  and not connect_oracle.
> 3. This fn is defined in a library made of c sources. When I do nm of this
> lib
>    the symbol is defined as connect_oracle.
> 4. Even though I give the full path of this library at the time of linking,
> the linker does not
>    resolve this symbol from the library.
> 
> I cannot understand this behavior of the linker.
> 
> Any pointers

I think the reason is of "name mangling" in C++. IMHO, You can fix by
having the following declaration:
extern "C" your-function-declaration;
in your cpp file.
For example:
extern "C" connect_oracle( char * server, char *db , char * user, char
*passwd );

Hope this helps,

Vu


-- 
Solaris-x86 8  @ Home



More information about the Gcc-help mailing list