locked
How to link WS2_32.lib? RRS feed

  • Question

  • 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

    Thursday, July 20, 2006 3:45 PM

Answers

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

    Thursday, July 20, 2006 5:10 PM

All replies

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

    Thursday, July 20, 2006 5:10 PM
  • 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...

    Thursday, December 13, 2007 5:21 PM
  • You also can use in the Following way.
    #pragma comment(lib, "ws2_32.lib")

    Thanx
    • Proposed as answer by ALJI Mohamed Friday, July 8, 2011 12:25 PM
    Thursday, December 13, 2007 5:27 PM
  • You also can use in the Following way.
    #pragma comment(lib, "ws2_32.lib")

    Thanx

    Thanks a lot, this solved my two weeks old problem :)

    some details for people who face a similar problem in future:

    I was trying to use VXL library with visual studio 2012. I successfully compiled the library and could also execute the simple hello world program. However, I couldn't execute any program for image processing. I had many link errors like the following:

    Monday, September 23, 2013 4:42 PM
  • Hi,

    any idea which library is compatible with Win CE 7.0?

    I thin ws2.lib is not compatible with it. I am getting the following errors..any idea how to resolve it?

    LINK : warning LNK4010: invalid subsystem version number 0x700; default subsystem version assumed

    coredll.lib(COREDLL.dll) : fatal error LNK1112: module machine type 'THUMB' conflicts with target machine type 'ARM'

    Project : warning PRJ0018 : The following environment variables were not found:
    10>$(PLATFORMDEFINES


    Dipk11

    Thursday, December 14, 2017 11:22 AM