Compile error

Original Discord Post by nathansrig | 2024-07-23 20:40:02

I’m getting a error compiling the unreal plug-in

Reply by nathansrig | 2024-07-23 20:41:53

P:\UnrealInstall\UE_5.4\Engine\Source\Runtime\Core\Public\String\FormatStringSan.h(99): error C2338: static_assert failed: ‘’%s’ expects TCHAR*; use ‘%hs’ for const char*.’
P:\UnrealInstall\UE_5.4\Engine\Source\Runtime\Core\Public\String\FormatStringSan.h(99): note: the template instantiation context (the oldest one first) is
P:\ConvaiBuild\Convai-UnrealEngine-SDK\Output\Convai-UnrealEngine-SDK\HostProject\Plugins\ConvAI\Source\Convai\Private\ConvaiGRPC.cpp(1024): note: see reference to class template instantiation ‘UE::Core::Private::FormatStringSan::TPresentErr<1>::TErrMsg<UE::Core::Private::FormatStringSan::TAtArgPos<2>>’ being compiled

Error executing C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\Hostx64\x64\cl.exe (tool returned code: 2)

Reply by nathansrig | 2024-07-23 20:41:59

Modifying line 1025 and 1035 in ConvaiGRPC.cpp fixed the local compile error I was getting

Reply by nathansrig | 2024-07-23 20:42:07

void UConvaiGRPCSubmitFeedbackProxy::BeginDestroy()
{
clientcontext.TryCancel();
stub.reset();
UE_LOG(ConvaiGRPCFeedBackLog, Log,
TEXT(“On Stream Finish | Interaction ID : %s | Feedback Text : %s | ThumbsUp: %hs”),
*InteractionID,
*FeedbackText,
ThumbsUp ? “True” : “False”);
Super::BeginDestroy();
}

void UConvaiGRPCSubmitFeedbackProxy::LogAndEcecuteFailure(FString FuncName)
{
UE_LOG(ConvaiGRPCFeedBackLog, Warning,
TEXT(“%s: Status:%s | Debug Log:%s | Error message:%s | Error Details:%s | Error Code:%i | Interaction ID : %s | Feedback Text : %s | ThumbsUp: %hs”),
*FString(FuncName),
*FString(status.ok() ? “Ok” : “Not Ok”),
*FString(reply->DebugString().c_str()),
*FString(status.error_message().c_str()),
*FString(status.error_details().c_str()),
status.error_code(),
*InteractionID,
*FeedbackText,
ThumbsUp ? “True” : “False”);

failed();

}

Reply by k3kalinix | 2024-07-23 21:42:22

<@&1163218672580575372>

Reply by freezfast | 2024-07-23 21:43:56

Thank you <@657352508288663552> for creating another ticket. This is an issue on the latest msvc compiler, <@1216254232957685765> please provide steps on how to solve

Reply by mighty_brute | 2024-07-24 07:38:39

Hello <@657352508288663552> ,

The compilation error is due to the MSVC compiler version. You can either use precompiled binaries of the plugin, which will work fine. On the other hand, if you want to compile the plugin yourself, you can replace the %s with %hs.

To use precompiled binaries, make sure that in the Convai.build.cs file, bUsePrecompiled is set to true.

Reply by freezfast | 2024-07-24 10:38:05

We are still working on fixing this issue in the plugin and we should probably have a fix pushed by next week, but feel free to try the above solution as well

Replying to mighty_brute’s Message

Reply by mighty_brute | 2024-07-24 07:38:39
Hello <@657352508288663552> ,

The compilation error is due to the MSVC compiler version. You can either use precompiled binaries of the plugin, which will work fine. On the other hand, if you want to compile the plugin yourself, you can replace the %s with %hs.

To use precompiled binaries, make sure that in the Convai.build.cs file, bUsePrecompiled is set to true.

Reply by kongshuangquan | 2024-07-24 17:46:14

same error , do I need to replace all %s to %hs, but mine still not work.

Reply by kongshuangquan | 2024-07-24 17:46:26

F:\UnrealEngine-5.4.3-release\UnrealEngine-5.4.3-release\Engine\Source\Runtime\Core\Public\String\FormatStringSan.h(100): error C2338: static_assert failed: ‘’%hs’ expects char*; use ‘%s’ for const TCHAR*, TEXT(...), etc.’
F:\shit\Convai-UnrealEngine-SDK\Output\Convai-UnrealEngine-SDK\HostProject\Plugins\ConvAI\Source\Convai\Private\ConvaiGRPC.cpp(163): note: 查看对正在编译的 类 模板 实例化“UE::Core::Private::FormatStringSan::TPresentErr<2>::TErrMsg<UE::Core::Private::FormatStringSan::TAtArgPos<0>>”的引用

Error executing D:\VS\VisualStudio\VC\Tools\MSVC\14.37.32822\bin\Hostx64\x64\cl.exe (tool returned code: 2)

Reply by kongshuangquan | 2024-07-24 17:50:07

<@1216254232957685765>

Reply by nathansrig | 2024-07-24 18:05:21

Its not all the %s that need to be replaced. Only the “ThumbsUp: %s” to “ThumbsUp: %hs” on line 1025 ans 1035 in ConvaiGRPC.cpp

Reply by nathansrig | 2024-07-24 18:05:36

At least that’s what worked for me

Reply by freezfast | 2024-07-24 23:55:01

Thank you <@657352508288663552>, apparently this issue is starting to appear for some developers, it is most likely some recent msvc compiler update since it still compiles fine for others, we will have an update fix for that by next week

Replying to nathansrig’s Message

Reply by nathansrig | 2024-07-24 18:05:36
At least that’s what worked for me

Reply by kongshuangquan | 2024-07-25 01:59:48

Thank you so much, that’s also worked for me.

This conversation happened on the Convai Discord Server, so this post will be closed.