I am building a C++ program that queries against Active Directory using (Apache Directory studio) LDAP . Iam doing it with codeblocks IDE and windows 10. I have the following code sample from the program:
#include<iostream>
#include<windows.h>
#include<winldap.h>
using namespace std;
int main() {
LDAP* testLdapConnection = NULL;
ULONG version = LDAP_VERSION1;
ULONG connectionSuccess = 0;
testLdapConnection = ldap_initA("localhost",389);
if(testLdapConnection==NULL){
cout<<"connection Failed";
}
else{
cout<<"Success";
}
}
When I try to build this sample in codeblocks, the build fails and the line with ldap_init() is underlined in red. When I hover the mouse over the error, it says "Undefined reference to _imp__ldap_initA()."
您必须将Wldap32.lib添加到项目中的链接库列表中。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.