ws2_32.lib vs. libws2_32.a, what's the difference and how to link libws2_32 to NB project?
I use NetBeans, Windows and Cygwin with g++ compiler. I'm examining Windows Sockets 2. I do everything that is written in MS manual . I have a code (mostly from this manual): #include <winsock2.h> #include <ws2tcpip.h> #include <cstdlib> #include <iostream> #pragma comment(lib, "Ws2_32.lib") int main() { WSADATA wsaData; int iResult; // Initialize Winsock iResult = WSAStartup(MAKEWORD(2,2), &wsaData); if (iResult != 0) { printf("WSAStartup failed: %d\n", iResult); return 1; } else cout << "Initialization OK."; return 0; } And I have a problem when I try to run the project: undefined reference