Adding Photon SDK to unreal engine project in MacOS, the project fails to build.

We downloaded the newer version of Photon SDK to add it in Unreal engine project for MacOS. We made changes as suggested in the in the doc link - https://doc.photonengine.com/en-us/realtime/current/getting-started/unreal-engine. Then tried to build the project, it throws following errors in XCODE -

(project path)/Source/Photon/Common-cpp/inc/Helpers/ConfirmAllowed.h:27:67: Type 'long' cannot be used prior to '::' because it has no members

(project path)/Source/Photon/Common-cpp/inc/Helpers/ConfirmAllowed.h:32:41: Type 'long' cannot be used prior to '::' because it has no members

(project path)/Source/Photon/LoadBalancing-cpp/inc/Client.h:225:73: Incomplete definition of type 'ExitGames::Common::Helpers::ConfirmAllowed'

Please help us to resolve the issue.

Thanks

Answers

  • Kaiserludi
    Kaiserludi admin
    edited February 2019
    Hi @Manjunath.

    Which version of Xcode, of Unreal Engine and of the Photon OS X Client SDK do you use?

    In version 4.1.9.0 of the Client SDK Source/Photon/LoadBalancing-cpp/inc/Client.h:225 points to the line inside the implementation of Client::opRaiseEvent(), which throws a compile time assert when the caller tries to pass payload data of an unsupported type to opRaiseEvent().

    The code that checks if the given data type is a supported type is inside ConfirmAllowed.h.
    Hence the compile error inside that file tells us that the unsupported type is that some code tries to pass to opRaiseEvent() is type 'long'.

    However the Unreal engine demo project does not have any opRaiseEvent()-call in which it would pass a long to opRaiseEvent(), so I assume that this is not a problem with the demo, but you get that error when building your own project with custom opRaiseEvent()-calls.
    Is that correct?

    Please make sure that you only pass supported data types as payload data to opRaiseEvent() (see http://doc-api.photonengine.com/en/cpp/current/html/a05589.html for a list of supported data types).

    Instead of a long you would use an int if you need a 32bit or a long long if you need a 64bit type.

    As a side note I would recommend to in general avoid the usage of type long as if it was the plague, because it is a porting nightmare (on 32bit OS and on 64bit Windows a long is 32bit, but on 64bit Unixes (like 64bit OS X) a long is 64bit). If you need a 32bit type, then use int, if your want a 64bit type,the use long long, and if you need a type that has the same size as a pointer (32bit on all 32bit OS and 64bit on all 64 bit OS), then use size_t. That way your type will always have the correct size on all platforms, while with type long you will most certainly run into nasty surprises when porting the code.