Linking to libsmbclient.so

Peter Waechtler peter at helios.de
Thu Mar 11 13:10:52 GMT 2004


Am Donnerstag, 11. März 2004 13:46 schrieb Steven McClellan:
> Hello,
>
> I am trying to compile a test program and link to the libsmbclient.so
> shared library and ld is producing an error:
>
> [steve at localhost steve]$ gcc testsmbc.cc
> /usr/local/samba/lib/libsmbclient.so -o testsmbc
>
> /tmp/cczi0mto.o(.text+0x1f3): In function `main':
> : undefined reference to `smbc_init(void (*)(char const*, char const*,
>
> char*, int, char*, int, char*, int), int)'
> /tmp/cczi0mto.o(.eh_frame+0x11): undefined reference to
> `__gxx_personality_v0'
> collect2: ld returned 1 exit status
>
> This test program only makes reference to one function for simplicity in
> troubleshooting - smbc_init, and the code has been taken directly from the
> libsmbclient example of testsmbc.  The only change is that I have changed
> the extension of the source file from .c to .cc.  If I change it back to .c
> then it compiles and links just fine, but with the .cc extension it doesn't
> link.
>
> I suspect C++ name mangling but I just don't know what is going on.  Since
> all of my other source code for the project is .cc and I really can't
> change it - I am just trying to add samba capability to it
>
> So, is there any way to be able to link to the libsmbclient.so from C++?
>

#ifdef __cplusplus
extern "C" {
#endif

int smbc_init(smbc_get_auth_data_fn fn, int debug);

#ifdef __cplusplus
}
#endif



More information about the samba-technical mailing list