Download

UPD socket programming under Windows

Hi,
I am trying to uses UDP sockets in Unreal/ CarLa under windows 10.
When I add the include Networking.h in in a *.h file ( ie CarlaWheeledVehicle.h)
#pragma once

#include "WheeledVehicle.h"

#include "Vehicle/CarlaWheeledVehicleState.h"
#include "Vehicle/VehicleControl.h"
#include "Vehicle/VehicleLightState.h"
#include "Vehicle/VehicleInputPriority.h"
#include "Vehicle/VehiclePhysicsControl.h"
#include "VehicleVelocityControl.h"
#include "WheeledVehicleMovementComponent4W.h"
#include "CoreMinimal.h" 
#include "Networking.h"

//-----CARSIM--------------------------------
#ifdef WITH_CARSIM
#include "../../../../TnoSim/public/CarSimMovementComponent.h"
#endif
//-------------------------------------------
#include "CarlaWheeledVehicle.generated.h"

I get the following error messages:

[Adaptive unity build] Excluded from PhysXVehicles unity file: PhysXVehicleManager.cpp
Building 9 actions with 12 processes...
  [1/9] Module.Carla.gen.1_of_6.cpp
  d:\unrealengine\engine\source\runtime\sockets\public\IPAddress.h(310): error C2039: '_InterlockedExchange': is not a member of 'FWindowsPlatformAtomics'
  D:\UnrealEngine\Engine\Source\Runtime\Core\Public\Windows/WindowsPlatformAtomics.h(13): note: see declaration of 'FWindowsPlatformAtomics'
  d:\unrealengine\engine\source\runtime\sockets\public\IPAddress.h(310): error C2665: '_InterlockedExchange': none of the 4 overloads could convert all the argument types
  C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winbase.h(9401): note: could be 'unsigned __int64 _InterlockedExchange(volatile unsigned __int64 *,unsigned __int64)'
  C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winbase.h(9389): note: or       'unsigned long _InterlockedExchange(volatile unsigned long *,unsigned long)'
  C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winbase.h(9379): note: or       'unsigned int _InterlockedExchange(volatile unsigned int *,unsigned int)'
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\INCLUDE\intrin0.h(160): note: or       'long _InterlockedExchange(volatile long *,long)'
  d:\unrealengine\engine\source\runtime\sockets\public\IPAddress.h(310): note: while trying to match the argument list '(volatile int32 *, bool)'
  [2/9] Module.Carla.gen.4_of_6.cpp
  d:\unrealengine\engine\source\runtime\sockets\public\IPAddress.h(310): error C2039: '_InterlockedExchange': is not a member of 'FWindowsPlatformAtomics'
  D:\UnrealEngine\Engine\Source\Runtime\Core\Public\Windows/WindowsPlatformAtomics.h(13): note: see declaration of 'FWindowsPlatformAtomics'
  d:\unrealengine\engine\source\runtime\sockets\public\IPAddress.h(310): error C2665: '_InterlockedExchange': none of the 4 overloads could convert all the argument types
  C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winbase.h(9401): note: could be 'unsigned __int64 _InterlockedExchange(volatile unsigned __int64 *,unsigned __int64)'
  C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winbase.h(9389): note: or       'unsigned long _InterlockedExchange(volatile unsigned long *,unsigned long)'
  C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winbase.h(9379): note: or       'unsigned int _InterlockedExchange(volatile unsigned int *,unsigned int)'
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\INCLUDE\intrin0.h(160): note: or       'long _InterlockedExchange(volatile long *,long)'
  d:\unrealengine\engine\source\runtime\sockets\public\IPAddress.h(310): note: while trying to match the argument list '(volatile int32 *, bool)'
  [3/9] Module.Carla.gen.3_of_6.cpp
  d:\unrealengine\engine\source\runtime\sockets\public\IPAddress.h(310): error C2039: '_InterlockedExchange': is not a member of 'FWindowsPlatformAtomics'
  D:\UnrealEngine\Engine\Source\Runtime\Core\Public\Windows/WindowsPlatformAtomics.h(13): note: see declaration of 'FWindowsPlatformAtomics'
  d:\unrealengine\engine\source\runtime\sockets\public\IPAddress.h(310): error C2665: '_InterlockedExchange': none of the 4 overloads could convert all the argument types
  C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winbase.h(9401): note: could be 'unsigned __int64 _InterlockedExchange(volatile unsigned __int64 *,unsigned __int64)'
  C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winbase.h(9389): note: or       'unsigned long _InterlockedExchange(volatile unsigned long *,unsigned long)'
  C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um\winbase.h(9379): note: or   'unsigned int _InterlockedExchange(volatile unsigned int *,unsigned int)'

When I use :

#include "AllowWindowsPlatformTypes.h"

#include "Networking.h"

#include "HideWindowsPlatformTypes.h"

I get the following errors:

Building 9 actions with 12 processes…
[1/9] Module.Carla.gen.1_of_6.cpp

You have included windows.h before MinWindows.h
All useless stuff from the windows headers won’t be excluded !!!

D:\UnrealEngine\Engine\Source\Runtime\Core\Public\Windows/MinWindows.h(44): warning C4005: ‘NOMINMAX’: macro redefinition
D:\carla\Unreal\CarlaUE4\Plugins\Carla\CarlaDependencies\include\boost/asio/detail/config.hpp(1019): note: see previous definition of ‘NOMINMAX’
D:\carla\Unreal\CarlaUE4\Plugins\Carla\CarlaDependencies\include\boost/asio/detail/impl/win_static_mutex.ipp(56): error C2065: ‘TRUE’: undeclared identifier
D:\carla\Unreal\CarlaUE4\Plugins\Carla\CarlaDependencies\include\boost/asio/detail/impl/win_thread.ipp(46): error C2065: ‘FALSE’: undeclared identifier
D:\carla\Unreal\CarlaUE4\Plugins\Carla\CarlaDependencies\include\boost/asio/detail/impl/win_thread.ipp(131): error C2065: ‘TRUE’: undeclared identifier

Under linux I have no problems.

Can anybody tell me what I am missing or doing wrong?