I am developing a C++ application which deals with socket programming. When I build my program, I get an error as follows,

------ Build started: Project: AFEClientPublic, Configuration: Debug Win32 ------
LINK : fatal error LNK1104: cannot open file 'wsock32.lib'
Build log was saved at "file://d:\AfeClientPublic43\AFEClientPublic43\Debug\BuildLog.htm"
AFEClientPublic - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I have also downloaded the wsock32.lib from web but I dont know where to place it to make my program run. Kindly guide me furthure.

11 Years
Discussion Span
Last Post by vijayan121

It doesnt matter where you put the wsock32.lib file. Just link it properly with the /link switch of your compiler. From the looks of it, you seem to be using the Visual C++ compiler. I thought the wsock32.lib file came with it by default and you wouldn't have to download it.

Anyway, if you are using the Visual Studio IDE, you can select "Add files to project" and select the wsock32.lib and build. Should work.


if you are using the current version of platform sdk:
header is winsock2.h
import library (link to) ws2_32.lib
shared library (dll) ws2_32.dll

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.