[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: could not work in C++?



thanks, I have to these deprecate interfaces because I use cldap in win32.
gtalk:freeespeech@gmail.com


On Mon, Apr 4, 2011 at 5:31 PM, Hallvard B Furuseth <h.b.furuseth@usit.uio.no> wrote:
owen nirvana writes:
> error is the following:
> error: 'ldap_init' was not decalred in this scope
> error: 'ldap_simple_bind_s' was not decalred in this scope
> error: 'ldap_unbind' was not decalred in this scope

These calls are deprecated, even thouth that's undocumented except with
ldap_init.  To get them back, do

#define LDAP_DEPRECATED 1
before #include <ldap.h>

or use the _ext versions of the calls.  Likely you should in any case
replace ldap_init with the more flexible ldap_initialize(), which allows
you to pass an LDAP URL and check error codes on failure.

> I have added extern "C" {} block.  With my means, it will be compiled using
> gcc actually. So it work fine in gcc, it should be fine in g++.

You can remove the extern "C" {}, the ldap.h header itself takes care of
that.  And note that it doesn't mean anything gets compiled with gcc,
or that C syntax is valid inside the {}, just that the functions are
C functions and not subject to C++ name mangling etc.

--
Hallvard