I thought that when I install gcc and mingw that crucial windows libraries are already imported with that. Apperantly not. Now how do I give the gcc linker the required libraries so that it can link the assembly of this code?
#include <Winsock2.h>
//#include <Ws2_32.lib> why can't I type it like this?
#pragma comment(lib, "Ws2_32.lib")
void main(){
WSADATA Winsockdata;
WSAStartup(MAKEWORD(2,2), &Winsockdata);
socket(AF_UNIX, SOCK_STREAM,0);
}
I get the following error:
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:Userspc2AppDataLocalTempccd7HYF8.o:main.c:(.text+0x24): undefined reference to `__imp_WSAStartup’
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:Userspc2AppDataLocalTempccd7HYF8.o:main.c:(.text+0x3d): undefined reference to `__imp_socket’
collect2.exe: error: ld returned 1 exit status
I think I saw some similar questions which say that you can use -L but I think I don’t have this library installed. Where do I install it?