Can you reproduce the errors when compiling a file containing
#include <winsock2.h>
and nothing else? What if you compile manually in the terminal instead of using cmake?