[Samba] c++ with libsmbclient

Razvan roti at ss.pub.ro
Wed Nov 27 18:31:12 GMT 2002


Hi,

What i want is to write a code that scans the network for hosts and
shares. I figured the shared library libsmbclient from samba is just what
i need. Problem: a cannot compile my program in c++, only in c. When i
change the extension of my source file from .c to .cpp (i use gcc, or
g++) i get linker errors:

[roti at manitu lyta]$ gcc -lsmbclient scan.cpp
/tmp/ccD9lo2a.o: In function `main':
/tmp/ccD9lo2a.o(.text+0x234): undefined reference to `smbc_init(void
(*)(char const *, char const *, char *, int, char *, int, char *, int),
int)'
/tmp/ccD9lo2a.o(.text+0x249): undefined reference to `smbc_opendir(char
const *)'
/tmp/ccD9lo2a.o(.text+0x2b3): undefined reference to
`smbc_getdents(unsigned int, smbc_dirent *, int)'
collect2: ld returned 1 exit status

I installed libsmbclient.so in a different way. I already have samba (on
Mandrake 8.2) but libsmbclient was not there, so i downloaded the source
code, ./configure'd it, make bin/libsmbclient.so'd it,copied
libsmbclient.so to /usr/bin and runned ldconfig. Still the library works
but only in c++. Why?




More information about the samba mailing list