Trouble using windows includes with DWORD, INT

Hello,

I’m trying to use a static library that use some includes files of windows sdk (winsock2.h) but I get compilation errors about ambiguous symbols: DWORD and INT.
I searched in the documentation and those symbols appears to be, in unreal, typedef of “FUnusableClass”.

Why prevent the use of those symbols?
Maybe we are not supposed to use Windows stuff directly and must use Unreal’s instead, like here?

What I’m trying to do is integrate a library we made, based on network library asio (Asio C++ Library), in our unreal project. So what can/should i do?

Nadège

Where we need access to the Windows types in engine, we wrap the include in:

#include "AllowWindowsPlatformTypes.h"
#include "MyWindowsStuff.h"
#include "HideWindowsPlatformTypes.h"

nice thank you !

Where is the MyWindowsStuff.h file?
I insert the above code but the compile error that “no such or directory about the MyWindowsStuff.h” apeears.

You dont actually include “MyWindowStuff.h” you substitute that for the headers that require windows platform types. So in your case the ffmpeg headers.

Hi.
Thanks for your answer.
I insert ffmpeg headers like this, but errors not disppear.

#include "AllowWindowsPlatformTypes.h" 
#include "ffmpeginc.h" 
#include "HideWindowsPlatformTypes.h"

there are follow souce code in ffmpeginc.h file

    #pragma once 

    #ifdef __cplusplus 
    extern "C" { 

    #include <libavutil/avutil.h> 
    #include <libavutil/imgutils.h> 
    #include <libavcodec/avcodec.h> 
    #include <libavformat/avformat.h> 
    #include <libswscale/swscale.h> 

    } 
    #endif

-this is the error
1>C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcasync.h(126): error C2872: ‘UINT’ : ambiguous symbol
1> could be ‘C:\Program Files (x86)\Windows Kits\8.1\include\shared\minwindef.h(177) : unsigned int UINT’
1> or ‘C:\Program Files\Unreal Engine\4.4\Engine\Source\Runtime\Core\Public\Core.h(491) : DoNotUseOldUE4Type::UINT’
Please explain how can I fix it.

My Version…

In my static blueprint utilities class. Also I use 2 static buffers for the data gets.

in the .h

UFUNCTION(BlueprintCallable, Category = TheVoidUtils)
	static FString GetMachineIP();

top of the .cpp

#include "AllowWindowsPlatformTypes.h"
#include "winsock.h"
#include "HideWindowsPlatformTypes.h"

in the .cpp

char VOIDIP_hostname[1024];
char VOIDIP_IPSTRING[1024];

FString UUnrealVoidUtils::GetMachineIP()
{
#ifdef WIN32
	WSADATA wsaData;
	WORD wVersionRequested = MAKEWORD(2, 0);
	if (::WSAStartup(wVersionRequested, &wsaData) != 0)
		return FString(TEXT("NO WINSOCK"));
#endif

	if (gethostname(VOIDIP_hostname, sizeof(VOIDIP_hostname)) == SOCKET_ERROR)
	{
#ifdef WIN32
		WSACleanup();
#endif
		return FString(TEXT("WINSOCK ERROR"));
	}
	
	struct hostent *host = gethostbyname(VOIDIP_hostname);
	if (host == NULL)
	{
#ifdef WIN32
		WSACleanup();
#endif
		return FString(TEXT("GET HOST ERROR"));
	}

	sprintf(VOIDIP_IPSTRING, "%d.%d.%d.%d",
		 (int32)(((struct in_addr *)(host->h_addr))->S_un.S_un_b.s_b1),
		 (int32)(((struct in_addr *)(host->h_addr))->S_un.S_un_b.s_b2),
		 (int32)(((struct in_addr *)(host->h_addr))->S_un.S_un_b.s_b3),
		 (int32)(((struct in_addr *)(host->h_addr))->S_un.S_un_b.s_b4));
#ifdef WIN32
	WSACleanup();
#endif

	return FString(VOIDIP_IPSTRING);
}