无法构建LSP样本

时间:2010-11-01 15:58:36

标签: visual-c++ build windows-xp winsock-lsp

我下载了Microsoft平台SDK。我试图在

下构建示例项目LSP
  

C:\ Program Files \ Microsoft Platform   SDK \样品\ 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包含在已创建的项目中。

有任何想法或建议吗?

1 个答案:

答案 0 :(得分:0)

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

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

你也没有链接ws2_32.lib