编VC网络程序遇到一个问题。原来是少了一个WSOCK32.LIB

告诫一下自己:
     在VC中进行WINSOCK的API编程开发的时候,需要在项目中使用下面三个文件,否则会出现编译错误。
  1.WINSOCK.H: 这是WINSOCK API的头文件,需要包含在项目中。
  2.WSOCK32.LIB: WINSOCK API连接库文件。在使用中,一定要把它作为项目的非缺省的连接库包含到项目文件中去。
  3.WINSOCK.DLL: WINSOCK的动态连接库,位于WINDOWS的安装目录下。


--------------------Configuration: Example1 - Win32 Debug--------------------
Linking...
Client.obj : error LNK2001: unresolved external symbol _connect@12
Client.obj : error LNK2001: unresolved external symbol _htons@4
Server.obj : error LNK2001: unresolved external symbol _htons@4
Client.obj : error LNK2001: unresolved external symbol _inet_addr@4
Client.obj : error LNK2001: unresolved external symbol _socket@12
Server.obj : error LNK2001: unresolved external symbol _socket@12
Client.obj : error LNK2001: unresolved external symbol _closesocket@4
Example1Dlg.obj : error LNK2001: unresolved external symbol _closesocket@4
Server.obj : error LNK2001: unresolved external symbol _closesocket@4
Client.obj : error LNK2001: unresolved external symbol _send@16
Example1Dlg.obj : error LNK2001: unresolved external symbol _send@16
Client.obj : error LNK2001: unresolved external symbol _recv@16
Example1Dlg.obj : error LNK2001: unresolved external symbol _recv@16
Client.obj : error LNK2001: unresolved external symbol _WSAAsyncSelect@16
Server.obj : error LNK2001: unresolved external symbol _WSAAsyncSelect@16
Example1Dlg.obj : error LNK2001: unresolved external symbol _WSAStartup@8
Example1Dlg.obj : error LNK2001: unresolved external symbol _accept@12
Server.obj : error LNK2001: unresolved external symbol _listen@8
Server.obj : error LNK2001: unresolved external symbol _bind@12
Debug/Example1.exe : fatal error LNK1120: 12 unresolved externals
Error executing link.exe.

Example1.exe - 20 error(s), 0 warning(s)

相关文章:

  • 2021-08-17
  • 2022-02-03
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
  • 2022-12-23
  • 2021-04-02
猜你喜欢
  • 2022-12-23
  • 2021-08-15
  • 2022-03-02
  • 2021-12-28
  • 2022-12-23
  • 2021-09-24
  • 2022-01-09
相关资源
相似解决方案