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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.