7 comments

Hello,

I've failed to reproduce this issue locally (with ReSharper 2021.3 and Unreal Engine 4.27.2 installed from Epic Games Launcher).
Could you please provide some details:

  • How did you set C++ 17 Standard? Did you set it in `BuildConfiguration.xml` located at `C:\Users\USER_NAME\Documents\Unreal Engine\UnrealBuildTool\`?
  • Do you have `Use Unreal Engine project model` enabled in settings here `ReSharper | Options | Code Editing | C++ | Unreal Engine`?
  • If this option is enabled could you please open `PROJECT_FOLDER\Intermediate\ProjectFiles\.Rider\ACTIVE_PLATFORM\CONFIGURATION\TARGET\PROJECT_NAME.json` and search for `CppStandard` attribute? Does it have `Cpp17` value set there? Or maybe you can share this file privately with us?
0

Hello.

1. CppStandard is set to Cpp17 in BuildConfiguraion.xml.

2. "Use Unreal Engine project model" option is enabled.

3. In the project json file, CppStandard is Cpp17.

Additionally, I am using the source version of the Unreal Engine.

0

That's strange. Basically ReSharper reads C++ standard version from this json file.
Could you please:

  1. Run Visual Studio with /ReSharper.Internal key to run R# in debug mode: devenv.exe /ReSharper.Internal
  2. Open the problematic solution and the file where C++17 features don't work
  3. Hit Alt+Enter shortcut
  4. Type in "Dump C++ inclusion context" action and execute it
  5. New text file will be opened. It will contain properties which are used for processing this file and two properties are of particular interest: "LanguageStandard" and "Properties retrieved from UE4 project model". Could you check their values?

Also what exactly C++17 feature is not working?

Thanks in advance!

0

Here is the dump result.

And it is the "if init syntax" and "template argument deduction syntax" where the problem occurred.

0

I've managed to reproduce this issue on my side. It appears that it is caused be several bugs.

Firstly there is an issue in UnrealBuildTool. In generated .vcxproj file there is following data which sets C++ version for IntelliSense:

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Development_Editor|x64'">
...
<AdditionalOptions>/std:c++17</AdditionalOptions>
</PropertyGroup>

But since UE 4.27.2 it also contains following element:

<ItemGroup>
<ClCompile Include="..\..\Source\RollingGame27\MyActor.cpp">
...
<AdditionalOptions>/Yu"$(SolutionDir)Intermediate\Build\Win64\RollingGame27Editor\Development\Engine\SharedPCH.Engine.ShadowErrors.h"</AdditionalOptions>
</ClCompile>
</ItemGroup>

It sets precompiled header for each .cpp file and it clears whatever other options were set for it (including C++ version).
I'll take a look at what can be done here but the fix should be in the UnrealBuildTool.

Second issue is that we're using C++ settings from .vcxproj file and not from .json (despite enabled option in the settings). This line tells us about that:

Properties retrieved from UE4 project model: no

I'm not sure why that happens though we're chasing one known random bug which causes this: RSCPP-30911.
If you could collect verbose logs and share them with us it might help us in investigating this issue. The instruction on how to collect logs can be found here: How-to-run-ReSharper-with-logging. File with logs can be attached in YouTrack ticket with jetbrains-team visibility.

And the last one - there is a workaround:

It applies to the specific project and it will override C++ version for ReSharper no matter what is written in .vcxproj and .json files.

Thank you again and sorry for inconvenience!

0

Hmm... It's going to be annoying and difficult.
I will override CppStarndard for now.
Thank you for helping me.

0

I have filled a bug report here: UE-137267

And apparently it was fixed but only in ue5 branch: https://github.com/EpicGames/UnrealEngine/commit/3744d4e088c8613c2e1a99e081849d648ecfdc94

If you're using source build - it should be possible to cherry-pick and back-port this fix.

0

Please sign in to leave a comment.