0

Microsoft プラットフォーム 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作成したプロジェクトに含めました。

アイデアや提案はありますか?

4

1 に答える 1

0

include/lib パスが正しくないようです。

最初に PSDK をインクルード パスに含める必要があります。または、PSDK 環境を実行してから /useenv フラグを指定して IDE を実行することもできます。

また、ws2_32.lib をリンクしていません。

于 2010-11-01T17:45:12.293 に答える