Force C++ language version?

We are try to using Visual Studio 2017 with ReSharper++ and VisualGDB for developing embedded application.

But RS++ not resolve current C++ version (C++17).

Is possible to force language version for project?

At the moment working with RC++ is very dificult.

Thanks,

Andrzej Tatar

5 comments

Hello Andrzej,

At the moment R++ reads language version only from project settings. The feature request to implement a dedicated setting is https://youtrack.jetbrains.com/issue/RSCPP-22285.

In your case you need to instruct VisualGDB to pass the "/std:c++17" command-line argument to IntelliSense. R++ will then pick it up and enable C++17 support.

0

It seems to me that RS++ resolved the correct C++ version.
My changes:
- added line in VS project : <LanguageStandard>stdcpplatest</LanguageStandard>
- forced included file that contains:
      #ifdef __cplusplus
      #undef __cplusplus
      #define __cplusplus 201704U
      #endif

0

You are right, it looks like the value of __cplusplus is not defined according to the language standard with non-MSVC toolsets. I'll fix this in 2018.3 so the #ifdef is not necessary - https://youtrack.jetbrains.com/issue/RSCPP-24361.

Note that you can also use the __RESHARPER__ macro to add defines just for R++, so something like this should also work:

#ifdef __RESHARPER__
#define __cplusplus 201704U
#endif
0

The __cplusplus define should no longer be necessary in EAP 7 (https://www.jetbrains.com/resharper/eap/), the language standard option should be enough. Please let me know if you still experience the issue.

0

It seems to me that works good, but I had to turn off Visual Studio IntelliSense manually because red underscores (errors) were visible.

Now everything looks great.

0

Please sign in to leave a comment.