无法构建LSP示例

发布于 2024-09-30 07:14:36 字数 7293 浏览 4 评论 0原文

我下载了微软平台的SDK。我尝试在下面构建示例项目 LSP

C:\Program Files\Microsoft 平台 SDK\Samples\NetDS\WinSock\LSP

我收到以下链接错误:

asyncselect.obj : error LNK2001: unresolved external symbol "struct HINSTANCE__ * gDllInstance" (?gDllInstance@@3PAUHINSTANCE__@@A)
asyncselect.obj : error LNK2001: unresolved external symbol "void * gAddContextEvent" (?gAddContextEvent@@3PAXA)
sockinfo.obj : error LNK2001: unresolved external symbol "void * gAddContextEvent" (?gAddContextEvent@@3PAXA)
extension.obj : error LNK2019: unresolved external symbol __imp__WSASetLastError@4 referenced in function "int __stdcall ExtTransmitFile(unsigned int,void *,unsigned long,unsigned long,struct _OVERLAPPED *,struct _TRANSMIT_FILE_BUFFERS *,unsigned long)" (?ExtTransmitFile@@YGHIPAXKKPAU_OVERLAPPED@@PAU_TRANSMIT_FILE_BUFFERS@@K@Z)
overlap.obj : error LNK2001: unresolved external symbol __imp__WSASetLastError@4
extension.obj : error LNK2019: unresolved external symbol __imp__WSAGetLastError@0 referenced in function "int __stdcall ExtTransmitFile(unsigned int,void *,unsigned long,unsigned long,struct _OVERLAPPED *,struct _TRANSMIT_FILE_BUFFERS *,unsigned long)" (?ExtTransmitFile@@YGHIPAXKKPAU_OVERLAPPED@@PAU_TRANSMIT_FILE_BUFFERS@@K@Z)
overlap.obj : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
instlsp.obj : error LNK2019: unresolved external symbol __imp__WSACleanup@0 referenced in function _main
instlsp.obj : error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function _main
lspadd.obj : error LNK2019: unresolved external symbol _WSCInstallProvider@20 referenced in function "int __cdecl InstallProvider(enum WINSOCK_CATALOG,struct _GUID *,wchar_t *,struct _WSAPROTOCOL_INFOW *,int)" (?InstallProvider@@YAHW4WINSOCK_CATALOG@@PAU_GUID@@PA_WPAU_WSAPROTOCOL_INFOW@@H@Z)
lspadd.obj : error LNK2019: unresolved external symbol _WSCGetProviderPath@16 referenced in function "int __cdecl InstallIfsLspProtocolChains(enum WINSOCK_CATALOG,struct _GUID *,wchar_t *,wchar_t *,unsigned long *,unsigned long)" (?InstallIfsLspProtocolChains@@YAHW4WINSOCK_CATALOG@@PAU_GUID@@PA_W2PAKK@Z)
lspmap.obj : error LNK2001: unresolved external symbol _WSCGetProviderPath@16
prnpinfo.obj : error LNK2001: unresolved external symbol _WSCGetProviderPath@16
provider.obj : error LNK2001: unresolved external symbol _WSCGetProviderPath@16
lspadd.obj : error LNK2019: unresolved external symbol __imp__UuidCreate@4 referenced in function "int __cdecl InstallIfsLspProtocolChains(enum WINSOCK_CATALOG,struct _GUID *,wchar_t *,wchar_t *,unsigned long *,unsigned long)" (?InstallIfsLspProtocolChains@@YAHW4WINSOCK_CATALOG@@PAU_GUID@@PA_W2PAKK@Z)
lspadd.obj : error LNK2019: unresolved external symbol _WSCWriteProviderOrder@8 referenced in function "int __cdecl WriteProviderOrder(enum WINSOCK_CATALOG,unsigned long *,unsigned long,int *)" (?WriteProviderOrder@@YAHW4WINSOCK_CATALOG@@PAKKPAH@Z)
lspdel.obj : error LNK2019: unresolved external symbol _WSCDeinstallProvider@8 referenced in function "int __cdecl DeinstallProvider(enum WINSOCK_CATALOG,struct _GUID *)" (?DeinstallProvider@@YAHW4WINSOCK_CATALOG@@PAU_GUID@@@Z)
overlap.obj : error LNK2001: unresolved external symbol "struct _RTL_CRITICAL_SECTION gOverlappedCS" (?gOverlappedCS@@3U_RTL_CRITICAL_SECTION@@A)
overlap.obj : error LNK2019: unresolved external symbol "void __cdecl FreeWSABuf(struct _WSABUF *)" (?FreeWSABuf@@YAXPAU_WSABUF@@@Z) referenced in function "void __cdecl FreeOverlappedStructure(struct _WSAOVERLAPPEDPLUS *)" (?FreeOverlappedStructure@@YAXPAU_WSAOVERLAPPEDPLUS@@@Z)
overlap.obj : error LNK2019: unresolved external symbol _WPUCompleteOverlappedRequest@20 referenced in function "void __stdcall IntermediateCompletionRoutine(unsigned long,unsigned long,struct _OVERLAPPED *,unsigned long)" (?IntermediateCompletionRoutine@@YGXKKPAU_OVERLAPPED@@K@Z)
overlap.obj : error LNK2019: unresolved external symbol "struct _WSABUF * __cdecl CopyWSABuf(struct _WSABUF *,unsigned long,int *)" (?CopyWSABuf@@YAPAU_WSABUF@@PAU1@KPAH@Z) referenced in function "struct _WSAOVERLAPPEDPLUS * __cdecl PrepareOverlappedOperation(struct _SOCK_INFO *,enum LspOperation,struct _WSABUF *,unsigned long,struct _OVERLAPPED *,void (__stdcall*)(unsigned long,unsigned long,struct _OVERLAPPED *,unsigned long),struct _WSATHREADID *,int *)" (?PrepareOverlappedOperation@@YAPAU_WSAOVERLAPPEDPLUS@@PAU_SOCK_INFO@@W4LspOperation@@PAU_WSABUF@@KPAU_OVERLAPPED@@P6GXKK3K@ZPAU_WSATHREADID@@PAH@Z)
overlap.obj : error LNK2019: unresolved external symbol "void __cdecl CopyOffset(struct _OVERLAPPED *,struct _OVERLAPPED *)" (?CopyOffset@@YAXPAU_OVERLAPPED@@0@Z) referenced in function "struct _WSAOVERLAPPEDPLUS * __cdecl PrepareOverlappedOperation(struct _SOCK_INFO *,enum LspOperation,struct _WSABUF *,unsigned long,struct _OVERLAPPED *,void (__stdcall*)(unsigned long,unsigned long,struct _OVERLAPPED *,unsigned long),struct _WSATHREADID *,int *)" (?PrepareOverlappedOperation@@YAPAU_WSAOVERLAPPEDPLUS@@PAU_SOCK_INFO@@W4LspOperation@@PAU_WSABUF@@KPAU_OVERLAPPED@@P6GXKK3K@ZPAU_WSATHREADID@@PAH@Z)
provider.obj : error LNK2019: unresolved external symbol _WSCEnumProtocols@16 referenced in function "struct _WSAPROTOCOL_INFOW * __cdecl EnumerateProviders(enum WINSOCK_CATALOG,int *)" (?EnumerateProviders@@YAPAU_WSAPROTOCOL_INFOW@@W4WINSOCK_CATALOG@@PAH@Z)
sockinfo.obj : error LNK2001: unresolved external symbol "struct _PROVIDER * gBaseInfo" (?gBaseInfo@@3PAU_PROVIDER@@A)
spi.obj : error LNK2019: unresolved external symbol "struct _SOCKET_CONTEXT * __cdecl FindSocketContext(unsigned int,int)" (?FindSocketContext@@YAPAU_SOCKET_CONTEXT@@IH@Z) referenced in function "int __stdcall WSPCloseSocket(unsigned int,int *)" (?WSPCloseSocket@@YGHIPAH@Z)
spi.obj : error LNK2019: unresolved external symbol "void __cdecl FreeSocketContext(struct _PROVIDER *,struct _SOCKET_CONTEXT *)" (?FreeSocketContext@@YAXPAU_PROVIDER@@PAU_SOCKET_CONTEXT@@@Z) referenced in function "unsigned int __stdcall WSPSocket(int,int,int,struct _WSAPROTOCOL_INFOW *,unsigned int,unsigned long,int *)" (?WSPSocket@@YGIHHHPAU_WSAPROTOCOL_INFOW@@IKPAH@Z)
spi.obj : error LNK2019: unresolved external symbol "struct _SOCKET_CONTEXT * __cdecl CreateSocketContext(struct _PROVIDER *,unsigned int,int *)" (?CreateSocketContext@@YAPAU_SOCKET_CONTEXT@@PAU_PROVIDER@@IPAH@Z) referenced in function "unsigned int __stdcall WSPSocket(int,int,int,struct _WSAPROTOCOL_INFOW *,unsigned int,unsigned long,int *)" (?WSPSocket@@YGIHHHPAU_WSAPROTOCOL_INFOW@@IKPAH@Z)
spi.obj : error LNK2019: unresolved external symbol __imp__inet_addr@4 referenced in function "void __cdecl FindDestinationAddress(struct _SOCKET_CONTEXT *,struct sockaddr const *,int,struct sockaddr * *,int *)" (?FindDestinationAddress@@YAXPAU_SOCKET_CONTEXT@@PBUsockaddr@@HPAPAU2@PAH@Z)
spi.obj : error LNK2019: unresolved external symbol "void __cdecl FreeSocketContextList(struct _PROVIDER *)" (?FreeSocketContextList@@YAXPAU_PROVIDER@@@Z) referenced in function "void __cdecl FreeLspProviders(struct _PROVIDER *,int,int *)" (?FreeLspProviders@@YAXPAU_PROVIDER@@HPAH@Z)
Debug\My_LSP.exe : fatal error LNK1120: 23 unresolved externals

我在 Windows XP 上使用 Visual C++ 2008 Express。我将文件夹 includelib 添加到创建的项目中。

有什么想法或建议吗?

I downloaded Microsoft platform SDK. I tried to build the sample project LSP under

C:\Program Files\Microsoft Platform
SDK\Samples\NetDS\WinSock\LSP

I got the following linking errors:

asyncselect.obj : error LNK2001: unresolved external symbol "struct HINSTANCE__ * gDllInstance" (?gDllInstance@@3PAUHINSTANCE__@@A)
asyncselect.obj : error LNK2001: unresolved external symbol "void * gAddContextEvent" (?gAddContextEvent@@3PAXA)
sockinfo.obj : error LNK2001: unresolved external symbol "void * gAddContextEvent" (?gAddContextEvent@@3PAXA)
extension.obj : error LNK2019: unresolved external symbol __imp__WSASetLastError@4 referenced in function "int __stdcall ExtTransmitFile(unsigned int,void *,unsigned long,unsigned long,struct _OVERLAPPED *,struct _TRANSMIT_FILE_BUFFERS *,unsigned long)" (?ExtTransmitFile@@YGHIPAXKKPAU_OVERLAPPED@@PAU_TRANSMIT_FILE_BUFFERS@@K@Z)
overlap.obj : error LNK2001: unresolved external symbol __imp__WSASetLastError@4
extension.obj : error LNK2019: unresolved external symbol __imp__WSAGetLastError@0 referenced in function "int __stdcall ExtTransmitFile(unsigned int,void *,unsigned long,unsigned long,struct _OVERLAPPED *,struct _TRANSMIT_FILE_BUFFERS *,unsigned long)" (?ExtTransmitFile@@YGHIPAXKKPAU_OVERLAPPED@@PAU_TRANSMIT_FILE_BUFFERS@@K@Z)
overlap.obj : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
instlsp.obj : error LNK2019: unresolved external symbol __imp__WSACleanup@0 referenced in function _main
instlsp.obj : error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function _main
lspadd.obj : error LNK2019: unresolved external symbol _WSCInstallProvider@20 referenced in function "int __cdecl InstallProvider(enum WINSOCK_CATALOG,struct _GUID *,wchar_t *,struct _WSAPROTOCOL_INFOW *,int)" (?InstallProvider@@YAHW4WINSOCK_CATALOG@@PAU_GUID@@PA_WPAU_WSAPROTOCOL_INFOW@@H@Z)
lspadd.obj : error LNK2019: unresolved external symbol _WSCGetProviderPath@16 referenced in function "int __cdecl InstallIfsLspProtocolChains(enum WINSOCK_CATALOG,struct _GUID *,wchar_t *,wchar_t *,unsigned long *,unsigned long)" (?InstallIfsLspProtocolChains@@YAHW4WINSOCK_CATALOG@@PAU_GUID@@PA_W2PAKK@Z)
lspmap.obj : error LNK2001: unresolved external symbol _WSCGetProviderPath@16
prnpinfo.obj : error LNK2001: unresolved external symbol _WSCGetProviderPath@16
provider.obj : error LNK2001: unresolved external symbol _WSCGetProviderPath@16
lspadd.obj : error LNK2019: unresolved external symbol __imp__UuidCreate@4 referenced in function "int __cdecl InstallIfsLspProtocolChains(enum WINSOCK_CATALOG,struct _GUID *,wchar_t *,wchar_t *,unsigned long *,unsigned long)" (?InstallIfsLspProtocolChains@@YAHW4WINSOCK_CATALOG@@PAU_GUID@@PA_W2PAKK@Z)
lspadd.obj : error LNK2019: unresolved external symbol _WSCWriteProviderOrder@8 referenced in function "int __cdecl WriteProviderOrder(enum WINSOCK_CATALOG,unsigned long *,unsigned long,int *)" (?WriteProviderOrder@@YAHW4WINSOCK_CATALOG@@PAKKPAH@Z)
lspdel.obj : error LNK2019: unresolved external symbol _WSCDeinstallProvider@8 referenced in function "int __cdecl DeinstallProvider(enum WINSOCK_CATALOG,struct _GUID *)" (?DeinstallProvider@@YAHW4WINSOCK_CATALOG@@PAU_GUID@@@Z)
overlap.obj : error LNK2001: unresolved external symbol "struct _RTL_CRITICAL_SECTION gOverlappedCS" (?gOverlappedCS@@3U_RTL_CRITICAL_SECTION@@A)
overlap.obj : error LNK2019: unresolved external symbol "void __cdecl FreeWSABuf(struct _WSABUF *)" (?FreeWSABuf@@YAXPAU_WSABUF@@@Z) referenced in function "void __cdecl FreeOverlappedStructure(struct _WSAOVERLAPPEDPLUS *)" (?FreeOverlappedStructure@@YAXPAU_WSAOVERLAPPEDPLUS@@@Z)
overlap.obj : error LNK2019: unresolved external symbol _WPUCompleteOverlappedRequest@20 referenced in function "void __stdcall IntermediateCompletionRoutine(unsigned long,unsigned long,struct _OVERLAPPED *,unsigned long)" (?IntermediateCompletionRoutine@@YGXKKPAU_OVERLAPPED@@K@Z)
overlap.obj : error LNK2019: unresolved external symbol "struct _WSABUF * __cdecl CopyWSABuf(struct _WSABUF *,unsigned long,int *)" (?CopyWSABuf@@YAPAU_WSABUF@@PAU1@KPAH@Z) referenced in function "struct _WSAOVERLAPPEDPLUS * __cdecl PrepareOverlappedOperation(struct _SOCK_INFO *,enum LspOperation,struct _WSABUF *,unsigned long,struct _OVERLAPPED *,void (__stdcall*)(unsigned long,unsigned long,struct _OVERLAPPED *,unsigned long),struct _WSATHREADID *,int *)" (?PrepareOverlappedOperation@@YAPAU_WSAOVERLAPPEDPLUS@@PAU_SOCK_INFO@@W4LspOperation@@PAU_WSABUF@@KPAU_OVERLAPPED@@P6GXKK3K@ZPAU_WSATHREADID@@PAH@Z)
overlap.obj : error LNK2019: unresolved external symbol "void __cdecl CopyOffset(struct _OVERLAPPED *,struct _OVERLAPPED *)" (?CopyOffset@@YAXPAU_OVERLAPPED@@0@Z) referenced in function "struct _WSAOVERLAPPEDPLUS * __cdecl PrepareOverlappedOperation(struct _SOCK_INFO *,enum LspOperation,struct _WSABUF *,unsigned long,struct _OVERLAPPED *,void (__stdcall*)(unsigned long,unsigned long,struct _OVERLAPPED *,unsigned long),struct _WSATHREADID *,int *)" (?PrepareOverlappedOperation@@YAPAU_WSAOVERLAPPEDPLUS@@PAU_SOCK_INFO@@W4LspOperation@@PAU_WSABUF@@KPAU_OVERLAPPED@@P6GXKK3K@ZPAU_WSATHREADID@@PAH@Z)
provider.obj : error LNK2019: unresolved external symbol _WSCEnumProtocols@16 referenced in function "struct _WSAPROTOCOL_INFOW * __cdecl EnumerateProviders(enum WINSOCK_CATALOG,int *)" (?EnumerateProviders@@YAPAU_WSAPROTOCOL_INFOW@@W4WINSOCK_CATALOG@@PAH@Z)
sockinfo.obj : error LNK2001: unresolved external symbol "struct _PROVIDER * gBaseInfo" (?gBaseInfo@@3PAU_PROVIDER@@A)
spi.obj : error LNK2019: unresolved external symbol "struct _SOCKET_CONTEXT * __cdecl FindSocketContext(unsigned int,int)" (?FindSocketContext@@YAPAU_SOCKET_CONTEXT@@IH@Z) referenced in function "int __stdcall WSPCloseSocket(unsigned int,int *)" (?WSPCloseSocket@@YGHIPAH@Z)
spi.obj : error LNK2019: unresolved external symbol "void __cdecl FreeSocketContext(struct _PROVIDER *,struct _SOCKET_CONTEXT *)" (?FreeSocketContext@@YAXPAU_PROVIDER@@PAU_SOCKET_CONTEXT@@@Z) referenced in function "unsigned int __stdcall WSPSocket(int,int,int,struct _WSAPROTOCOL_INFOW *,unsigned int,unsigned long,int *)" (?WSPSocket@@YGIHHHPAU_WSAPROTOCOL_INFOW@@IKPAH@Z)
spi.obj : error LNK2019: unresolved external symbol "struct _SOCKET_CONTEXT * __cdecl CreateSocketContext(struct _PROVIDER *,unsigned int,int *)" (?CreateSocketContext@@YAPAU_SOCKET_CONTEXT@@PAU_PROVIDER@@IPAH@Z) referenced in function "unsigned int __stdcall WSPSocket(int,int,int,struct _WSAPROTOCOL_INFOW *,unsigned int,unsigned long,int *)" (?WSPSocket@@YGIHHHPAU_WSAPROTOCOL_INFOW@@IKPAH@Z)
spi.obj : error LNK2019: unresolved external symbol __imp__inet_addr@4 referenced in function "void __cdecl FindDestinationAddress(struct _SOCKET_CONTEXT *,struct sockaddr const *,int,struct sockaddr * *,int *)" (?FindDestinationAddress@@YAXPAU_SOCKET_CONTEXT@@PBUsockaddr@@HPAPAU2@PAH@Z)
spi.obj : error LNK2019: unresolved external symbol "void __cdecl FreeSocketContextList(struct _PROVIDER *)" (?FreeSocketContextList@@YAXPAU_PROVIDER@@@Z) referenced in function "void __cdecl FreeLspProviders(struct _PROVIDER *,int,int *)" (?FreeLspProviders@@YAXPAU_PROVIDER@@HPAH@Z)
Debug\My_LSP.exe : fatal error LNK1120: 23 unresolved externals

I am using Visual C++ 2008 Express on Windows XP. I included the folders include and lib to the created project.

Any idea or suggestion?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

剩一世无双 2024-10-07 07:14:36

看起来 include/lib 路径不正确。

您需要首先将 PSDK 包含在包含路径中,或者您可以运行 PSDK 环境,然后使用 /useenv 标志运行 IDE。

你也没有链接 ws2_32.lib

It looks like the include/lib paths are incorrect.

You need to have the PSDK first in the include path or you can run the PSDK environment and then run your IDE with the /useenv flag.

Also you didn't link ws2_32.lib

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文