• Upgrade your Internet Experience
  • Sign in
  • Microsoft.com
  • United States (English)
    Brasil (Português)Česká republika (Čeština)Deutschland (Deutsch)España (Español)France (Français)Italia (Italiano)Россия (Русский)대한민국 (한국어)中华人民共和国 (中文)台灣 (中文)日本 (日本語)香港特别行政區 (中文)
 
 
Visual C++ Developer Center
 
 
Home
 
 
Library
 
 
Learn
 
 
Downloads
 
 
Support
 
 
Community
 
 
Forums
 
 
 
Visual C++ Developer Center > Visual C++ Forums > Visual C++ General > How to link WS2_32.lib?
Ask a questionAsk a question
Search Forums:
  • Search Visual C++ General Forum Search Visual C++ General Forum
  • Search All Visual C++ Forums Search All Visual C++ Forums
  • Search All MSDN Forums Search All MSDN Forums
 

AnswerHow to link WS2_32.lib?

  • Thursday, July 20, 2006 3:45 PMDrScheme Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0

    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

    • ReplyReply
    • QuoteQuote
     

Answers

  • Thursday, July 20, 2006 5:10 PMTed_ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Vote As Helpful
    0

    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.

    • ReplyReply
    • QuoteQuote
     

All Replies

  • Thursday, December 13, 2007 5:21 PManc3s Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0

    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...

    • ReplyReply
    • QuoteQuote
     
  • Thursday, December 13, 2007 5:27 PMPintu Shukla Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Vote As Helpful
    0
    You also can use in the Following way.
    #pragma comment(lib, "ws2_32.lib")

    Thanx
    • ReplyReply
    • QuoteQuote
     
Need Help with Forums? (FAQ)
 
© 2009 Microsoft Corporation. All rights reserved.
Terms of Use
|
Trademarks
|
Privacy Statement