Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ws2_32.lib missing from VS2010.What to do?

I am trying to get my hands on windows socket programming. I know that you have to #include winsock2.h and then link with ws2_32.lib. Problem is I do not have ws2_32.lib in my visual studio 2010 ultimate version.

What should I do to get it up and running?

Secondly, I stumble with integrating new API's in VS 2010 a lot. I keep on forgetting what to include and what to link and which files are included and which are linked.It would be great if you could point out a tutorial which gives a general procedure in VS 2010 to deal with include and lib files while integrating a new API.

like image 803
userXktape Avatar asked Apr 19 '13 12:04

userXktape


1 Answers

Most likely you do have this library but it must be added via Project->Poperties->Linker->Input->additional Dependencies. Type this there:

Ws2_32.lib

or programmatically:

#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdio.h>

#pragma comment(lib, "Ws2_32.lib")

int main() {
  return 0;
}
like image 139
4pie0 Avatar answered Nov 09 '22 23:11

4pie0