Error compiling for Android with Unreal C++ SDK

Options
I can compile for Windows with no problem, but when compiling for Android it returns this error:

this
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: In file included from F:/vrgame/Intermediate/Build/Android/vr_game/Development/vr_game/Module.vr_game.cpp:2:
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: ../../../../vr_game/Source/vr_game/Public\Room.h(162,4) : error: use of overloaded operator '>' is ambiguous (with operand types 'ELogVerbosity::Type' and 'int')
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: UE_LOG(LogTemp, Warning, TEXT("Room::PrintRoomProperties failed to get the JSON object"));
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: F:\sdks\UE_4.16\Engine\Source\Runtime\Core\Public\Logging\LogMacros.h(154,133) : note: expanded from macro 'UE_LOG'
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: static_assert((ELogVerbosity::Verbosity & ELogVerbosity::VerbosityMask) < ELogVerbosity::NumVerbosity && ELogVerbosity::Verbosity > 0, "Verbosity must be constant and in range."); \
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: ~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~


for this line of code:
UE_LOG(LogTemp, Warning, TEXT("Room:: getting properties"));

in fact, this error is repeated for each call of UE_LOG, so ,i think there is something wrong with types for logging ...

Comments

  • jbelonalea
    edited August 2017
    Options

    I can compile for Windows with no problem, but when compiling for Android it returns this error:
    logging ...

    i think it's related to this:
    /**
    		   @related JString
    		   operator>.
    		   The return value indicates the lexicographic relation between the operands.
    		   @returns true, if left operand is greater than right operand, false otherwise.*/
    		template<typename Etype>
    		bool operator>(const Etype& Lsh, const JString& Rsh)
    		{
    			return JString(Lsh) > Rsh;
    		}
    

    because of this:

    UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: F:/game/Source/Photon/Android/.\Common-cpp/inc/JString.h(273,8) : note: candidate function [with Etype = ELogVerbosity::Type]
    UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: bool operator>(const Etype& Lsh, const JString& Rsh)
  • Kaiserludi
    Options
    Hi @jbelonalea.

    Please have a look at the demo project that is available on https://doc.photonengine.com/en-us/realtime/current/getting-started/unreal-engine.

    That demo does successfully build for Android for us.

    So please try if build for Android for you and if it does, please compare the .Build.cs file of that demo with one of your project, to see what you are doing differently.
  • jbelonalea
    edited August 2017
    Options
    I can compile the demo with no problems with my plugins ,all the import libraries and so on, so the problem is something related to my specific project that i can't find, like i said, it builds for Windows but not for Android.
    I end up doing a different integration for import, I mean, after doing this :
    https://doc.photonengine.com/en-us/realtime/current/getting-started/unreal-engine
    for Android and Windows SDK's in different directories, I set a
    #define DBGPRINTF_LEVEL 6
    in the photon-import.h , and I had to remove all the template functions for JString operators:

    template<typename Etype> JString operator+(const JString& Lsh, const Etype& Rsh); template<typename Etype> JString operator+(const Etype& Lsh, const JString& Rsh); template<typename Etype> bool operator==(const JString& Lsh, const Etype& Rsh); template<typename Etype> bool operator==(const Etype& Lsh, const JString& Rsh); template<typename Etype> bool operator!=(const JString& Lsh, const Etype& Rsh); template<typename Etype> bool operator!=(const Etype& Lsh, const JString& Rsh); template<typename Etype> bool operator<(const JString& Lsh, const Etype& Rsh); template<typename Etype> bool operator<(const Etype& Lsh, const JString& Rsh); template<typename Etype> bool operator>(const JString& Lsh, const Etype& Rsh); template<typename Etype> bool operator>(const Etype& Lsh, const JString& Rsh); template<typename Etype> bool operator<=(const JString& Lsh, const Etype& Rsh); template<typename Etype> bool operator<=(const Etype& Lsh, const JString& Rsh); template<typename Etype> bool operator>=(const JString& Lsh, const Etype& Rsh); template<typename Etype> bool operator>=(const Etype& Lsh, const JString& Rsh);

    to be able to compile with the android ndk using unreal build menu.
    Because in the macro function definition for UE_LOG the condition
    ELogVerbosity::Verbosity > 0
    was trying to use the operator from JString template...
  • Kaiserludi
    Options
    Hi @jbelonalea.

    That sounds like either you are using "using namespace" too broadly and end up importing conflicting symbols for UE and Photon into the global namespace and it works with the demo because it does this less intensively or alternatively I could also imagine that the specific order in which header files are included causes some problems with macros in UE (UE does quite some ugly stuff with macros that makes it prone for such collisions with other 3rd party code, even if that other code safely wraps everything in namespaces). In the latter case it might help to try to rearrange the include order (include Photon headers before UE headers).
  • jbelonalea
    Options
    Rearrange the includes worked.
    Thanks
  • Kaiserludi
    Options
    Great.

    Thanks for the heads-up.