getnamo / SocketIOClient-Unreal

Socket.IO client plugin for the Unreal Engine.
Other
899 stars 240 forks source link

Cannot build SocketIO - 'WITH_OPUS' macro redefined #441

Open t0msk opened 2 months ago

t0msk commented 2 months ago

I use Unreal Engine 5.4 and SocketIO 2.8 for 5.4 version but when I try to build project I get:


[2/37] Compile CUBlueprintLibrary.cpp
In file included from /run/media/tomsk/Data/Projects/Unreal/socketio/Plugins/SocketIOClient/Source/CoreUtility/Private/CUBlueprintLibrary.cpp:23:
/run/media/tomsk/Data/Projects/Unreal/socketio/Plugins/SocketIOClient/Source/CoreUtility/Public/CUOpusCoder.h:7:9: error: 'WITH_OPUS' macro redefined [-Werror,-Wmacro-redefined]
#define WITH_OPUS (PLATFORM_WINDOWS || PLATFORM_UNIX || PLATFORM_ANDROID)
        ^
/run/media/tomsk/Data/Projects/Unreal/socketio/Plugins/SocketIOClient/Intermediate/Build/Linux/x64/UnrealEditor/Development/CoreUtility/Definitions.CoreUtility.h:19:9: note: previous definition is here
#define WITH_OPUS 1
        ^
1 error generated.
@progress 'Compiling C++ source code...' 8%
@progress 'Compiling C++ source code...' 11%
[3/37] Compile CUFileSubsystem.cpp
@progress 'Compiling C++ source code...' 14%
[4/37] Compile CUFileComponent.cpp
@progress 'Compiling C++ source code...' 16%
[5/37] Compile CUMeasureTimer.cpp
@progress 'Compiling C++ source code...' 19%
[6/37] Compile SharedPCH.Engine.Project.RTTI.ValApi.Cpp20.h
[7/37] Compile CUOpusCoder.cpp
In file included from /run/media/tomsk/Data/Projects/Unreal/socketio/Plugins/SocketIOClient/Source/CoreUtility/Private/CUOpusCoder.cpp:1:
/run/media/tomsk/Data/Projects/Unreal/socketio/Plugins/SocketIOClient/Source/CoreUtility/Public/CUOpusCoder.h:7:9: error: 'WITH_OPUS' macro redefined [-Werror,-Wmacro-redefined]
#define WITH_OPUS (PLATFORM_WINDOWS || PLATFORM_UNIX || PLATFORM_ANDROID)
        ^
/run/media/tomsk/Data/Projects/Unreal/socketio/Plugins/SocketIOClient/Intermediate/Build/Linux/x64/UnrealEditor/Development/CoreUtility/Definitions.CoreUtility.h:19:9: note: previous definition is here
#define WITH_OPUS 1
        ^
1 error generat
noahlacour commented 1 month ago

Same thing for me, specifically using the unreal build tool for plugins in Linux OS trying to fix the file gives other errors

foranie commented 1 month ago

I came in because of this problem too.

JNANEU commented 1 month ago

The problem occurs when the project is built for platforms other than Windows. The reason is to use the OpusAudioDecoder module which has a default definition of 1 module config: PublicDefinitions.Add("WITH_OPUS=1");. Which in turn, during the rebuild, adds the following definition to the Intermediate folder along the path: Plugins/SocketIOClient/Intermediate/Build/Android/a/UnrealGame/Shipping/CoreUtility/Definitions.CoreUtility.h

getnamo commented 1 month ago

potential fix pushed in 2.8.3, pull and test: https://github.com/getnamo/SocketIOClient-Unreal/commit/37212d28ea0e865e1cb82528839d98a42944a1cf