landelare / ue5coro

A C++20 coroutine implementation for Unreal Engine 5 that feels almost native.
BSD 3-Clause Clear License
543 stars 48 forks source link

Compile error? #15

Closed xermao closed 11 months ago

xermao commented 11 months ago

0>F:\UnrealProjects\Ue5CoroTest\Plugins\UE5Coro\Source\UE5CoroTests\Private\ReturnValueTest.cpp(121): Error C2065 : 'bInnerComplete': undeclared identifier

landelare commented 11 months ago

What compiler and what version?

xermao commented 11 months ago

vs2022+ue5.1

ameaninglessname commented 11 months ago

vs2022+ue5.1

That may not be enough, see: https://github.com/landelare/ue5coro/issues/13#issuecomment-1585592905

xermao commented 11 months ago

CONSOLE: Use build tool: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\MSBuild.exe

0:36:33 Building F:\UnrealProjects\Ue5CoroTest\Intermediate\ProjectFiles\Ue5CoroTest.vcxproj 0>F:\AsLocalBuilds511_0401\Engine\Windows\Engine\Build\BatchFiles\Build.bat Ue5CoroTestEditor Win64 Development -Project="F:\UnrealProjects\Ue5CoroTest\Ue5CoroTest.uproject" -WaitMutex -FromMsBuild 0>Running UnrealBuildTool: dotnet "....\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" Ue5CoroTestEditor Win64 Development -Project="F:\UnrealProjects\Ue5CoroTest\Ue5CoroTest.uproject" -WaitMutex -FromMsBuild 0>Log file: C:\Users\xermao\AppData\Local\UnrealBuildTool\Log.txt 0>Building Ue5CoroTestEditor... 0>Using Visual Studio 2022 14.33.31631 toolchain (C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.33.31629) and Windows 10.0.22621.0 SDK (C:\Program Files (x86)\Windows Kits\10). 0>[Upgrade] 0>[Upgrade] Using backward-compatible include order. The latest version of UE has changed the order of includes, which may require code changes. The current setting is: 0>[Upgrade] IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_0 0>[Upgrade] Suppress this message by setting 'IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_1;' in Ue5CoroTestEditor.Target.cs. 0>[Upgrade] Alternatively you can set this to 'EngineIncludeOrderVersion.Latest' to always use the latest include order. This will potentially cause compile errors when integrating new versions of the engine. 0>[Upgrade] 0>Determining max actions to execute in parallel (16 physical cores, 32 logical cores) 0> Executing up to 16 processes, one per physical core 0>Building 4 actions with 4 processes... 0>[1/4] Link UnrealEditor-UE5CoroTests.lib cancelled 0>[2/4] Link UnrealEditor-UE5CoroTests.dll cancelled 0>[3/4] WriteMetadata Ue5CoroTestEditor.target cancelled 0>[4/4] Compile ReturnValueTest.cpp 0>F:\UnrealProjects\Ue5CoroTest\Plugins\UE5Coro\Source\UE5CoroTests\Private\ReturnValueTest.cpp(121): Error C2065 : 'bInnerComplete': undeclared identifier 0>F:\UnrealProjects\Ue5CoroTest\Plugins\UE5Coro\Source\UE5CoroTests\Private\ReturnValueTest.cpp(158): Reference C2065 : see reference to function template instantiation 'void `anonymous-namespace'::DoTest<>(FAutomationTestBase &)' being compiled 0>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): Error MSB3073 : 命令“F:\AsLocalBuilds511_0401\Engine\Windows\Engine\Build\BatchFiles\Build.bat Ue5CoroTestEditor Win64 Development -Project="F:\UnrealProjects\Ue5CoroTest\Ue5CoroTest.uproject" -WaitMutex -FromMsBuild”已退出,代码为 6。 Build failed at 上午12:36:47

does this helpful?

landelare commented 11 months ago

You're using an old version of VS2022, please try updating. If you cannot, you can comment out that part of the code, it's only a test.

bInnerComplete itself is defined on line 116, and gets to line 121 via two [&] lambda captures in the CORO_R macro on lines 117 and 119; this is a bug in the compiler. The latest version of VS2022 and Clang both compile this code without a warning.

I pushed a compiler workaround attempt to the test branch, does that help?

xermao commented 11 months ago

OK,I delete old toolchain in C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC,and it can be compiled. Is there any way to choose verion of toolchain instead of delete them?

landelare commented 11 months ago

Not that I know of. You can switch between 2019 and 2022 using BuildConfiguration.xml and there's a blacklist somewhere inside of UBT (MicrosoftPlatformSDK.cs, BannedVisualCppVersions) where you can add your bad toolchain's version if you're running a source build. This won't help you much if you're using the build from the Epic launcher.

I would recommend only using the latest toolchain not just to get the plugin compiled, but also to avoid similar compiler bugs in your code.