getnamo / SocketIOClient-Unreal

Socket.IO client plugin for the Unreal Engine.
Other
885 stars 239 forks source link

Build failed when there are 30+ .cpp files in project #100

Closed Zbluu closed 6 years ago

Zbluu commented 6 years ago

Hello,

I've been used UE4 and socketio-client-ue4 for a few months now, and my project becomes more and more consequently, since today. In total, I have 29 .cpp files in my Source folder, and when i create and include one more, the build explodes. I have 100+ link errors in header files (that has no problems before). And when I delete this new .cpp file, the project compiles normally without errors.

Example of errors :

1>A:\Documents\mmo_client_ue4\Plugins\socketio-client-ue4\Source\SIOJson\Public\SIOJsonObject.h(27): error C2065: 'FJsonObject' : identificateur non déclaré
1>A:\Documents\mmo_client_ue4\Plugins\socketio-client-ue4\Source\SIOJson\Public\SIOJsonObject.h(27): error C2923: 'TSharedPtr' : 'FJsonObject' n'est pas un argument de type modèle valide pour le paramètre 'ObjectType'
1>A:\Documents\mmo_client_ue4\Plugins\socketio-client-ue4\Source\SIOJson\Public\SIOJsonObject.h(30): error C2065: 'FJsonObject' : identificateur non déclaré
1>A:\Documents\mmo_client_ue4\Plugins\socketio-client-ue4\Source\SIOJson\Public\SIOJsonObject.h(30): error C2923: 'TSharedPtr' : 'FJsonObject' n'est pas un argument de type modèle valide pour le paramètre 'ObjectType'
1>A:\Documents\mmo_client_ue4\Plugins\socketio-client-ue4\Source\SIOJson\Public\SIOJsonObject.h(174): error C2065: 'FJsonObject' : identificateur non déclaré
1>A:\Documents\mmo_client_ue4\Plugins\socketio-client-ue4\Source\SIOJson\Public\SIOJsonObject.h(174): error C2923: 'TSharedPtr' : 'FJsonObject' n'est pas un argument de type modèle valide pour le paramètre 'ObjectType'

I'm a beginner with the C++ programmation, maybe I miss something else ?

Thank you in advance for your help.

getnamo commented 6 years ago

Plugin/Engine version? This points to an include error.

try including

#include "CoreMinimal.h"
#include "Runtime/Json/Public/Dom/JsonObject.h"

in your project files that use SIOJson and ensure your build.cs includes both SIOJson and Json modules at least

         PublicDependencyModuleNames.AddRange(
                new string[]
                {
                "Core",
                "Json",
                "JsonUtilities",
                "SIOJson",
                    // ... add other public dependencies that you statically link with here ...
                }
         );

Finally try 'cleaning solution' and deleting all intermediate folders, regenerating the project files and rebuilding. Sometimes left over object files will have incorrect data in them and a full clean rebuild may be necessary.

Zbluu commented 6 years ago

Engine version : 4.19.2 Plugin version : 0.8.0

So i updated the plugin to the last release (0.9.0), and it seems to be working. But I need to include "JsonValue" and "JsonObject" in each file where i use them, which is not normal (can you confirm ?).

And just for information, I have warning when i build : 1>a:\documents\mmo_client_ue4\plugins\socketio-client-ue4\source\thirdparty\socketio\include\sio_socket.h(94): warning C4100: 'sock' : paramètre formel non référencé 1>a:\documents\mmo_client_ue4\plugins\socketio-client-ue4\source\thirdparty\socketio\include\sio_socket.h(95): warning C4100: 'sock' : paramètre formel non référencé 1>A:\Documents\mmo_client_ue4\Plugins\socketio-client-ue4\Source\ThirdParty\SocketIO\Include\sio_client.h(83): warning C4100: 'cl' : paramètre formel non référencé 1>A:\Documents\mmo_client_ue4\Plugins\socketio-client-ue4\Source\ThirdParty\SocketIO\Include\sio_client.h(84): warning C4100: 'cl' : paramètre formel non référencé

getnamo commented 6 years ago

The building requirements for packaged builds differ from those for the editor because of what is implicitly included/exposed. In general since 4.20 editor/engine builds require much stricter use of IWYU, you may consider using the latest master branch build (0.9.3 - https://github.com/getnamo/socketio-client-ue4/commit/d8e90ccddae1224f26bcf217f147591564776615) which was used to build for marketplace that requires this stricter setup. That build should have all the correct include headers and future releases will use this strictness moving forward for both git and mp.

Zbluu commented 6 years ago

I will use the latest master branch build so. Thanks for your help and reactivity, this is an amazing plugin.