Na primetr:
Dev C++ : Project > Project Options > Parameters > Add Library or Object > [pronadji i selektuj] libwsock32.a > Ok
Code:
#include <cstdlib>
#include <iostream>
#include <winsock2.h>
using namespace std;
int main(int argc, char *argv[])
{
WORD wVersionRequested;
WSADATA wsaData;
wVersionRequested = MAKEWORD(1, 1);
WSAStartup(wVersionRequested, &wsaData);
hostent *p;
char s[128];
char *p2;
// Naziv racunara
gethostname(s, 128);
p = gethostbyname(s);
cout << p->h_name << endl;
// IP adresa
p2 = inet_ntoa(*((in_addr *)p->h_addr));
cout << p2 << endl;
WSACleanup();
system("PAUSE");
return EXIT_SUCCESS;
}