Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Enet Winsock redefinition conflicts

This thread is locked; no one can reply to it. rss feed Print
Enet Winsock redefinition conflicts
JFlyer
Member #16,009
July 2015

So I get redefinition conflicts between winsock.h and winsock2.h in my project even though it shouldn't include winsock.h file anywhere, it just shows up in the external dependencies tab for some reason. The common #ifndef and #define WIN32_LEAN_AND_MEAN tricks have not solved the problem.

It does work in the main.cpp file like this:

#SelectExpand
1#include <enet.h> 2#include <allegro5/allegro.h>

But if I include the enet header in my network.h file where I keep all the networking related code like this:

#SelectExpand
1#pragma once 2#include <enet.h>

It will cause a big list of conflicts, this happens if I include Enet anywhere except in the main file:

#SelectExpand
1C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock2.h(2616): error C2375: 'WSAAsyncSelect' : redefinition; different linkage 21> 3C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(933) : see declaration of 'WSAAsyncSelect'

As far as I know Enet includes the winsock2.h file by itself but I don't know where the winsock.h include comes from, must be from all the other lib files (stdio, string, fstream etc.) I need in my project, I think some of those might include windows.h so I have no control over it, is there a way to get around this? I'm using VS2013 if that helps.

Go to: