看看缺什么

arden1019 2005-03-11 10:14:12
我在编译一个使用了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么?那个?
请指教
...全文
166 11 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
arden1019 2005-03-14
  • 打赏
  • 举报
回复
to hushuangyan74()
WLDAP32.LIB 就是它 谢谢。
bobob 2005-03-12
  • 打赏
  • 举报
回复
http://www.entwickler-forum.de/webx?50@204.rsBkaXfVfi6.0@.1dd04fe4
google里面搜出这个东东
arden1019 2005-03-12
  • 打赏
  • 举报
回复
大哥们也不是 winldap.lib ~ 能不能把我的程序在你们机器上调试下~看看少什么?我也估计是个库~
hushuangyan74 2005-03-12
  • 打赏
  • 举报
回复
楼主,你的静态库不对。应该是WLDAP32.LIB
你在VC-》Project->Settting->Link-》Object/Library modules的下面框的最后面加一个空格,
然后加入WLDAP32.LIB。
至于你这段代码,我不懂,就不说了。。。。你试试吧!
fanqing 2005-03-11
  • 打赏
  • 举报
回复
gz
surstar 2005-03-11
  • 打赏
  • 举报
回复
LDAP 是什么东西,好奇的说~
lzd 2005-03-11
  • 打赏
  • 举报
回复
Windap32.lib
bobob 2005-03-11
  • 打赏
  • 举报
回复
是winldap.lib
xuzheng318 2005-03-11
  • 打赏
  • 举报
回复
缺少.lib库!
arden1019 2005-03-11
  • 打赏
  • 举报
回复
Windap32.lib 是什么库? 为什么我在google、baidu、vivisimo上完全搜索不到它?

我的机器里也没有这个文件。

我相信windows系统文件在google上没有搜索不到的。。

大哥你是不是记错名字了?
arden1019 2005-03-11
  • 打赏
  • 举报
回复
LDAP的介绍:
http://computer.mblogger.cn/mwg_arden/posts/29707.aspx

16,548

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • AIGC Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧