看看缺什么
我在编译一个使用了LDAP的程序时,给我报错:
//LDAPEnumTop.c
#include <windows.h>
#include <stdio.h>
#include <winldap.h>
void main( )
{
PLDAP pldapSession; // LDAP session data
PLDAPMessage plmsgSearchResponse; // Server allocated response to
// search request
PLDAPMessage plmsgEntry; // Server allocated response to entry request
PCHAR pszDN; // LDAP distinguished name string
PCHAR* ppszDomainDN = NULL; // Domain DN (string allocated by LDAP
// library)
// Start an LDAP session to nearest LDAP server
pldapSession = ldap_init( NULL, LDAP_PORT );
// Authenticate using user's current credentials
ldap_bind_s( pldapSession, NULL, NULL, LDAP_AUTH_NEGOTIATE );
// Search the root of the LDAP server
ldap_search_s ( pldapSession, // Session handle
NULL, // Location to start search, NULL specifies top
// level
LDAP_SCOPE_BASE, // Search only the root entry (rootDSE)
NULL, // Search for all objects (only one for the
// RootDSE)
NULL, // No attributes specified, return all attributes
FALSE, // Return attributes types and values
&plmsgSearchResponse ); // Server allocates and fills
// with search results
// Using the defaultNamingContext attribute, get the distinguished
// name of the domain
ppszDomainDN = ldap_get_values( pldapSession, plmsgSearchResponse,
"defaultNamingContext");
// Display info
printf("Listing objects at %s.\nPress CTRL+C to interrupt.\n",
*ppszDomainDN);
// Search first level of root container
ldap_search_s ( pldapSession, // Session handle
*ppszDomainDN, // Location in directory to start search
LDAP_SCOPE_ONELEVEL, // Search first level below the
// base entry
NULL, // Search for all objects
NULL, // No attributes specified, return all attributes
FALSE, // Return attributes types and values
&plmsgSearchResponse ); // Server allocates and fills
// with search results
// Get the first entry from the search results
plmsgEntry = ldap_first_entry( pldapSession, plmsgSearchResponse );
while ( plmsgEntry ) {
// Get the distinguished name of the entry
pszDN = ldap_get_dn ( pldapSession, plmsgEntry );
// Print the DN of the entry
printf("%s\n", pszDN);
// Get next entry
plmsgEntry = ldap_next_entry( pldapSession, plmsgEntry );
}
// Instruct the library to free the search results
ldap_msgfree( plmsgSearchResponse );
// Free string allocated by the LDAP API
ldap_value_free ( ppszDomainDN );
// Close the session
ldap_unbind( pldapSession );
}
Compiling...
LDAPEnumTop.c
Linking...
LDAPEnumTop.obj : error LNK2001: unresolved external symbol __imp__ldap_unbind
LDAPEnumTop.obj : error LNK2001: unresolved external symbol __imp__ldap_value_free
LDAPEnumTop.obj : error LNK2001: unresolved external symbol __imp__ldap_msgfree
LDAPEnumTop.obj : error LNK2001: unresolved external symbol __imp__ldap_next_entry
LDAPEnumTop.obj : error LNK2001: unresolved external symbol __imp__ldap_get_dn
LDAPEnumTop.obj : error LNK2001: unresolved external symbol __imp__ldap_first_entry
LDAPEnumTop.obj : error LNK2001: unresolved external symbol __imp__ldap_get_values
LDAPEnumTop.obj : error LNK2001: unresolved external symbol __imp__ldap_search_s
LDAPEnumTop.obj : error LNK2001: unresolved external symbol __imp__ldap_bind_s
LDAPEnumTop.obj : error LNK2001: unresolved external symbol __imp__ldap_init
Debug/LDAPEnumTop.exe : fatal error LNK1120: 10 unresolved externals
Error executing link.exe.
我不知道在使用LDAP时需要什么lib么?那个?
请指教