MSDN > 論壇首頁 > Visual C++ General > How to link WS2_32.lib?
發問發問
 

已答覆How to link WS2_32.lib?

  • 2006年7月20日 下午 03:45DrScheme 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     

    Hello people,

    could anyone please tell me, how to link that library WS2_32.lib?

    I try to learn about windows sockets, but I get the LNK2019-Error. I know that I need the library but I don't know how to tell the linker the path to the lib!

    Thanks in advance

解答

  • 2006年7月20日 下午 05:10Ted_ 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     已答覆

    Are you talking about Visual C++ 2005? Then the necessary library files will already be installed on your machine and you simply need to specify ws2_32.lib as a library in

    Configuration properties - Linker - Input - Additional Dependencies.

所有回覆

  • 2006年7月20日 下午 05:10Ted_ 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     已答覆

    Are you talking about Visual C++ 2005? Then the necessary library files will already be installed on your machine and you simply need to specify ws2_32.lib as a library in

    Configuration properties - Linker - Input - Additional Dependencies.

  • 2007年12月13日 下午 05:21anc3s 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     

    To link from dos command prompt like me just add the option swith "/link C:\MyVisualStudio\VCxx\Lib\WS2_32.LIB" . There are no macro function like /MD which is used for linking MSVCRT.LIB so you have type it out with your location path. Type CL /? for further help.

    Hope this helps...

  • 2007年12月13日 下午 05:27Pintu Shukla 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    You also can use in the Following way.
    #pragma comment(lib, "ws2_32.lib")

    Thanx