4.0.5.0/VS2015/UE4 Compile error

Upgraded to the 4.0.5.0 SDK so I can compile in VS2015 and therefore use Photon with UE4.10, which requires VS2015. Fixed debug problems in my own code. When I compile now, I get an error associated with TypeCode in ConfirmAllowed.h. Here are the errors:

Severity Code Description Project File Line Suppression State Error C2039 'TypeCode': is not a member of 'ExitGames::Common::ValueObject<ExitGames::Common::JString>' ihmj C:\Users\Gage\Desktop\i-hate-my-job\Source\Photon\Common-cpp\inc\Helpers\ConfirmAllowed.h 27 Error C2882 'TypeCode': illegal use of namespace identifier in expression ihmj C:\Users\Gage\Desktop\i-hate-my-job\Source\Photon\Common-cpp\inc\Helpers\ConfirmAllowed.h 27 Error C2079 'ExitGames::Common::Helpers::ConfirmAllowed<ExitGames::Common::ValueObject<ExitGames::Common::JString>,0>::ASSERTION_FAILED_ERROR_UNSUPPORTED_VALUE_TYPE' uses undefined struct 'ExitGames::Common::Helpers::CompileTimeAssertTrue<false>' ihmj C:\Users\Gage\Desktop\i-hate-my-job\Source\Photon\Common-cpp\inc\Helpers\ConfirmAllowed.h 27

Comments

  • DG GageDG Gage
    edited January 2016
    Problem seems to be with COMPILE_TIME_ASSERT_TRUE_MSG? It's underlined in green in VS2015. When highlighted, it says:

    #define COMPILE_TIME_ASSERT_TRUE_MSG(expr,msg) ExitGames::Common::Helpers::CompileTimeAssertTrue,expr. ASSERTION_FAILED_## msg

    Function definition for 'COMPILE_TIME_ASSERT_TRUE_MSG' not found.

    ConfirmAllowed.h:
    namespace ExitGames { namespace Common { class Object; template<typename EType> class JVector; class Hashtable; template<typename EKeyType, typename EValueType> class Dictionary; namespace Helpers { template<typename CType, unsigned int N=0> struct ConfirmAllowed { COMPILE_TIME_ASSERT_TRUE_MSG((IsDerivedFrom<CType, CustomType<CType::TypeCode> >::Is), ERROR_UNSUPPORTED_VALUE_TYPE); typedef CType type; typedef CType scalarType; static const unsigned int dimensions = 0; static const nByte typeName = TypeCode::CUSTOM; static const nByte customTypeName = CType::TypeCode;

    CompileTimeAssertTrue.h:
    namespace ExitGames { namespace Common { namespace Helpers { template<bool> struct CompileTimeAssertTrue; template<> struct CompileTimeAssertTrue<true> {}; } } } #undef COMPILE_TIME_ASSERT_TRUE #define COMPILE_TIME_ASSERT_TRUE(expr) ExitGames::Common::Helpers::CompileTimeAssertTrue<expr> ASSERTION_FAILED #define COMPILE_TIME_ASSERT_TRUE_MSG(expr, msg) ExitGames::Common::Helpers::CompileTimeAssertTrue<expr> ASSERTION_FAILED_##msg #define COMPILE_TIME_ASSERT2_TRUE(expr) {ExitGames::Common::Helpers::CompileTimeAssertTrue<expr> ASSERTION_FAILED; (void)ASSERTION_FAILED;} #define COMPILE_TIME_ASSERT2_TRUE_MSG(expr, msg) {ExitGames::Common::Helpers::CompileTimeAssertTrue<expr> ASSERTION_FAILED_##msg; (void)ASSERTION_FAILED_##msg;}

    Not sure what's wrong, or if it's my fault or 4.0.5.0's
  • DG GageDG Gage
    edited January 2016
    When looking through these files from the older SDK, they seem to be the same. Did not have compile problems with the older SDKs. Hmm
  • KaiserludiKaiserludi admin
    edited January 2016
    Hi @DG Gage.

    I can't reproduce this with our UE demo. Everything works fine for me.

    VS2015 is not mandatory for UE4.10. You can specify that you want to continue using VS2013 by building UE from its github source and passing -2013 on the command line.

    However Photon 4.0.5.0 also works fine with UE4.10 when using VS2015.

    Please make sure to adjust your .Build.cs file to the switch in VS versions. With VS 2013 you need to reference the vc12 builds of the .lib files from the Photon Windows Client SDK, while with VS2015 you need to reference the vc14 builds.

    Furthermore there have been some breaking API changes between 4.0.4.1 and 4.0.5.0 that you have to adjust your code to. Maybe those changes and missing adjustments to them are causing your issues.
    Please carefully read the release-history files so you know what you need to adjust. You may also want to redownload our demo http://doc.photonengine.com/en/realtime/current/sdks-and-api/sdk-unreal-engine, which I have updated just a few minutes ago. The latest version of that demo is compatible to 4.0.5.0.

    Also please doublecheck that you have not missed any step in the guide on http://doc.photonengine.com/en/realtime/current/sdks-and-api/sdk-unreal-engine when updating to 4.0.5.0. You will need to adjust the headers again and of course you shoudl remove the old headers and libraries before pasting the include folders and libs from the new SDK into your project folder to avoid that any conflicting files from an older SDK version remain in your project folder.

    Here is a diff of the changes that I made when updating the demo from 4.0.4.1 to 4.0.5.0:
    
    Index: demo_particle_common/LoadBalancingListener.cpp
    ===================================================================
    --- demo_particle_common/LoadBalancingListener.cpp	(revision 5980)
    +++ demo_particle_common/LoadBalancingListener.cpp	(revision 5981)
    @@ -230,6 +230,18 @@
     		view->error("Warn: opCreateRoom() failed: %s", errorString.UTF8Representation().cstr() );
     }
     
    +void LoadBalancingListener::joinOrCreateRoomReturn(int localPlayerNr, const Hashtable& gameProperties, const Hashtable& playerProperties, int errorCode, const JString& errorString)
    +{
    +	updateState();
    +	if (errorCode == ErrorCode::OK)
    +	{
    +		view->info("room has been entered");
    +		afterRoomJoined(localPlayerNr);
    +	}
    +	else
    +		view->error("Warn: opJoinOrCreateRoom() failed: %s", errorString.UTF8Representation().cstr());
    +}
    +
     void LoadBalancingListener::joinRoomReturn(int localPlayerNr, const Hashtable& gameProperties, const Hashtable& playerProperties, int errorCode, const JString& errorString)
     {
     	updateState();
    @@ -389,8 +401,8 @@
     	Hashtable props;
     	props.put("s", gridSize);
     	props.put("m", map);
    -	if(lbc->opCreateRoom(name, true, true, 0, props))
    -		view->info( "Creating room %s", name );
    +	if(lbc->opCreateRoom(name, ExitGames::LoadBalancing::RoomOptions().setCustomRoomProperties(props)))
    +		view->info("Creating room %s", name);
     	else
     		view->error("Can't create room in current state");
     }
    @@ -441,12 +453,12 @@
     		nByte coords[] = {localPlayer.x, localPlayer.y};
     		data.put((nByte)1, coords, 2);
     
    -		if(sendGroup)
    -			lbc->opRaiseEvent(false, data, 2, 0, 0, 0, 0, 0, sendGroup);
    +		if (sendGroup)
    +			lbc->opRaiseEvent(false, data, 2, ExitGames::LoadBalancing::RaiseEventOptions().setInterestGroup(sendGroup));
     		else
     		{
    -			if(useGroups)
    -				lbc->opRaiseEvent(false, data, 2, 0, 0, 0, 0, 0, getGroupByPos());
    +			if (useGroups)
    +				lbc->opRaiseEvent(false, data, 2, ExitGames::LoadBalancing::RaiseEventOptions().setInterestGroup(getGroupByPos()));
     			else
     				lbc->opRaiseEvent(false, data, 2);
     		}
    @@ -461,7 +473,7 @@
     {
     	Hashtable data;	
     	data.put((nByte)1, localPlayer.color);
    -	lbc->opRaiseEvent(true, data, 1,0,ExitGames::Lite::EventCache::ADD_TO_ROOM_CACHE);
    +	lbc->opRaiseEvent(true, data, 1, ExitGames::LoadBalancing::RaiseEventOptions().setEventCaching(ExitGames::Lite::EventCache::ADD_TO_ROOM_CACHE));
     }
     
     int LoadBalancingListener::getGroupByPos(void)
    Index: demo_particle_common/LoadBalancingListener.h
    ===================================================================
    --- demo_particle_common/LoadBalancingListener.h	(revision 5980)
    +++ demo_particle_common/LoadBalancingListener.h	(revision 5981)
    @@ -89,6 +89,7 @@
     	virtual void connectReturn(int errorCode, const ExitGames::Common::JString& errorString);
     	virtual void disconnectReturn(void);
     	virtual void createRoomReturn(int localPlayerNr, const ExitGames::Common::Hashtable& gameProperties, const ExitGames::Common::Hashtable& playerProperties, int errorCode, const ExitGames::Common::JString& errorString);
    +	virtual void joinOrCreateRoomReturn(int localPlayerNr, const ExitGames::Common::Hashtable& gameProperties, const ExitGames::Common::Hashtable& playerProperties, int errorCode, const ExitGames::Common::JString& errorString);
     	virtual void joinRoomReturn(int localPlayerNr, const ExitGames::Common::Hashtable& gameProperties, const ExitGames::Common::Hashtable& playerProperties, int errorCode, const ExitGames::Common::JString& errorString);
     	virtual void joinRandomRoomReturn(int localPlayerNr, const ExitGames::Common::Hashtable& gameProperties, const ExitGames::Common::Hashtable& playerProperties, int errorCode, const ExitGames::Common::JString& errorString);
     	virtual void leaveRoomReturn(int errorCode, const ExitGames::Common::JString& errorString);
    Index: PhotonDemoParticle.Build.cs
    ===================================================================
    --- PhotonDemoParticle.Build.cs	(revision 5980)
    +++ PhotonDemoParticle.Build.cs	(revision 5981)
    @@ -45,7 +45,7 @@
     	private void AddPhotonLibPathWin(TargetInfo Target, string name)
     	{
     		string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "Win32";
    -		PublicAdditionalLibraries.Add(Path.Combine(PhotonPath, "lib", "Windows", name + "-cpp_vc12_release_windows_md_" + PlatformString + ".lib"));
    +		PublicAdditionalLibraries.Add(Path.Combine(PhotonPath, "lib", "Windows", name + "-cpp_vc14_release_windows_md_" + PlatformString + ".lib"));
     	}
     
     	private void AddPhotonLibPathAndroid(TargetInfo Target, string name)
    Index: PhotonLBClient.cpp
    ===================================================================
    --- PhotonLBClient.cpp	(revision 5980)
    +++ PhotonLBClient.cpp	(revision 5981)
    @@ -24,7 +24,7 @@
     	Super::BeginPlay();
     	srand(GETTIMEMS());
     	listener = new LoadBalancingListener(this);
    -	client = new ExitGames::LoadBalancing::Client(*listener, *AppID, *appVersion, ExitGames::Common::JString(L"UR") + GETTIMEMS());
    +	client = new ExitGames::LoadBalancing::Client(*listener, *AppID, *appVersion);
     	listener->setLBC(client);
     
     	automove = listener->getAutomove();
    @@ -35,7 +35,7 @@
     	ht.put(2, 2);
     	info("Connecting...");
     	info("appID is set to %ls", *AppID);
    -	client->connect(*serverAddress);
    +	client->connect(ExitGames::LoadBalancing::AuthenticationValues(), ExitGames::Common::JString(L"UR") + GETTIMEMS(), *serverAddress);
     
     }
    
    You likely need to do similar adjustments to your code.


    PS:
    C:\Users\Gage\Desktop\i-hate-my-job
    Maybe that has just demotivated your project source and it will magically start to compile again if you move it to C:\Users\Gage\Desktop\i-love-my-job ;-)
  • DG GageDG Gage
    edited January 2016
    Solved!

    Problem was with calling opSendPrivateMessage in chat. It's different now I guess. It was using ValueObject to covert an FString message to a JString message (I think...), but opSendPrivateMessage accepts an FString now, which is nice.
  • KaiserludiKaiserludi admin
    edited January 2016
    Hi @DG Gage.

    Ah, yeah, that's what the top entry in the 4.0.5.0 changes in release_history-chat-cpp.txt refers to:

    - changed: the following functions now directly accept every type of data as payload that is supported by Photons serialization, without the need for the caller to first wrap the payload in a Common::Object instance:
    - Peer::opPublishMessage()
    - Peer::opSendPrivateMessage()
    - Peer::opSetOnlineStatus()
    - Client::opPublishMessage()
    - Client::opSendPrivateMessage()
    - Client::opSetOnlineStatus()
    Those functions now accept their payload the same way like LoadBancing::Client::opRaiseEvent(), which is simpler to use than the old way.

    Actually it was previously expecting a Object-instance to wrap all the different kinds of supported data, while now it directly expects data of a supported type without a wrapper object. So if you wanted to send a string, it previously expected that you pass a ValueObject<JString>, while it now expects that you pass just a JString or alternatively a wchar_t* or a char*, which will automatically get converted to a JString.
    It still does not accept a FString, but the compiler figures out that FString and JString both offer converters to and from char*, so it accepts your FString and automatically calls the converters for you.
    However there is no converter between Object and char*, so it could not find a way to convert between FString and Object, which is why you could not pass an FString before.
  • DG GageDG Gage
    edited January 2016
    PS:
    C:\Users\Gage\Desktop\i-hate-my-job
    Maybe that has just demotivated your project source and it will magically start to compile again if you move it to C:\Users\Gage\Desktop\i-love-my-job ;-)
    Haha well unfortunately that's the name of the project!
  • Thanks for your awesome insights, as always!

    Onto the (maybe) final problem, seen in my sequel discussion!
Sign In or Register to comment.