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.