getnamo / SocketIOClient-Unreal

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

error 2019 missed lib in editor mode #80

Closed vttry closed 5 years ago

vttry commented 6 years ago

Hello i have an issue, i can't compile application in ue4 editor i use (SocketIO 0.6.4 and ue version - 4.17 )

error LNK2019: __declspec(dllimport) public: static class FString __cdecl USIOJConvert::ToJsonString(class TSharedPtr<class FJsonValue,0> const &)...

It looks like some libs are missed but in debug game are workings fine. What can might be wrong? In my build cs files i have SocketIOClient PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Json", "JsonUtilities","SocketIOClient" }); thank you for any help

getnamo commented 6 years ago

looks like you're missing the other dependent modules e.g. specifically "SIOJson" in this case. If you include classes from any of the other modules you'll need to include those as well: see https://github.com/getnamo/socketio-client-ue4/tree/0.7.3/Source for names

vttry commented 6 years ago

Hello getnamo, Thank you for your answer. I added this dependency module to build.cs. It was still doesen't compile for DebugGameEditor only for DebugGame. But error was change

Error   LNK2001  ""public: __cdecl FSocketIONative::FSocketIONative(void)" (??0FSocketIONative@@QEAA@XZ)" 

Error   LNK2001 ""public: void __cdecl FSocketIONative::Connect(class FString const &,class TSharedPtr<class FJsonObject,0> const &,class TSharedPtr<class FJsonObject,0> const &)" (?Connect@FSocketIONative@@QEAAXAEBVFString@@AEBV?$TSharedPtr@VFJsonObject@@$0A@@@1@Z)"     

Error   LNK2001 ""public: void __cdecl FSocketIONative::OnEvent(class FString const &,class TFunction<void __cdecl(class FString const &,class TSharedPtr<class FJsonValue,0> const &)>,class FString const &)" (?OnEvent@FSocketIONative@@QEAAXAEBVFString@@V?$TFunction@$$A6AXAEBVFString@@AEBV?$TSharedPtr@VFJsonValue@@$0A@@@@Z@@0@Z)"

I dont know the main. Why does it compile in DebugGame and doesen't compile in DebugGameEditor? I check it in two different projects - results are the same

getnamo commented 6 years ago

You'll need to provide a code example of what's failing to compile. Have you tried the latest build of the plugin and see if it also has the same issue? If it does, could you make a minimal project that reproduces this problem?

vttry commented 6 years ago

Hello getnamo, thank you for yor ansver. I use ue 4.17. Max version of socketio-client-ue4 which works wit this ue is 7.00. If I compile gameEditor build - all works fine,but if compile debugeditor - i have errors (see above) I made minimal project from ue template. I only add custom playercontroller class and only one metod inside mycontroller.cpp init() there is a code:

//mycontroller.h
#include "SocketIOClientComponent.h"
#include "SocketIONative.h"
#include "RemoteController.generated.h"

UCLASS()
class TESTPROJECT_API ARemoteController : public APlayerController
{
    GENERATED_BODY()
};

`
`//mycontroller.cpp
#include "RemoteController.h"

void init()
{
    FSocketIONative* NativeClient = new FSocketIONative;
    NativeClient->Connect(FString("http://127.0.0.1:3000"), nullptr, nullptr);
    NativeClient->OnEvent(
        FString("chat message"),
        [&](const FString& Event, const TSharedPtr<FJsonValue>& Message) {
    });
}
//projectBuild.css
using UnrealBuildTool;
public class TestProject : ModuleRules
{
    public TestProject(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "SocketIOClient",  "json"});
        PrivateDependencyModuleNames.AddRange(new string[] {  });
    }
}

There is a zip file with project. But if you want to compile it you have to comment metod init(), becase with editor buid it doesent work only with debug game. test.zip

getnamo commented 5 years ago

SIOJson is likely missing in public PublicDependencyModuleNames. Closing due to plugin age in question, update to newer and check if issue persists.