ldap_bind'i kullanmaya çalışıyorum ama bu hatayı al.C++ ldap.h kullanarak ldap.h
error: âldap_bindâ was not declared in this scope
kodu:
#include <lber.h>
#include <ldap.h>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
LDAP *ld;
char *ldap_host = "ldap://localhost";
int ldap_port = 389;
int auth_method = LDAP_AUTH_SIMPLE;
int desired_version = LDAP_VERSION3;
char *root_dn = "ou=people,dc=localhost,dc=local";
char *root_ps = "password";
int result;
result = ldap_initialize(&ld, ldap_host);
cout << "result: " << result << endl;
result = ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &desired_version);
cout << "result: " << result << endl;
result = ldap_bind_s(ld, root_dn, root_ps, auth_method);
cout << "result: " << result << endl;
}
Ben bu komutla derleme
g++ ldap.cpp -llber -lldap -o prog
TIA
Kodu inceledikten sonra, LDAP_DEPRECATED tanımlamak zorunda kaldım, bu yüzden doğru. Teşekkürler – Jeremiah
@Jeremiah: bunu mangaya koymadıkları için utanç verici. –