I Like It !

Tuesday, April 27, 2010

How to include winsock2.h in Visual C++ 6.0?

The problem lies here, you are missing the ws2_32.lib file in your project, assuming you have the platform sdk installed, you need to do the following:

(Press Alt + f7) or Project -> "yourprojectname" Properties -> +Configuration Properties -> +Linker -> Input, You are missing the ws2_32.lib addition dependencie, click -> Additional Dependencies, a button which reads "..." should appear at the end of that line, click it, and add ws2_32.lib in the text box, then "OK" out of everything, and try compiling your project...

If you're getting compiler errors like Nirvana try including winsock2.h before you include windows.h.

#include <winsock2.h>
#include <windows.h>