MATLAB Answers

Is Polyspace R2020b Bug Finder and Code Prover compatible with C++ in Visual Studio 2019 (16.7.3)?

7 views (last 30 days)
Hi, I'm attempting to use Polyspace 2020b Bug Finder and Code Prover on some large Visual Studio 2019 C++ projects but I ran into multiple compilation errors.
I then created a one-line "Hello World" console app and tried the same thing. However, I still get multiple errors from standard header files (see a selected few examples pasted below).
For HelloWorld, all of the errors are in in standard VC header files (vcruntime.h, limits.h, corecrt.h, vcruntime_new.h, vcruntime_new_debug.h, crtdbg.h, yvals.h and corecrt_math.h). The code compiles and runs correctly in Visual Studio.
The "C++ Standard Version" option was set to "cpp14" and "Compiler" was set to "visual15.x" (and I've tried different settings with these, but the result is similar).
The big question is:
Is Polyspace R2020b compatible with the Visual Studio 2019 C++ compiler?
I've spent ages searching round the docs but I have not been able to find a definative answer.
Thanks.
Martin
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\include\vcruntime.h, line 96: error: identifier "push" is undefined
| __pragma(pack(push, 8)) extern "C" {
| ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\include\vcruntime.h, line 252: error: identifier "size_t" is undefined
| template <typename _CountofType, size_t _SizeOfArray>
| ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\include\vcruntime.h, line 345: error: incomplete type is not allowed
| void __fastcall __security_check_cookie( uintptr_t _StackCookie);
| ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\include\vcruntime.h, line 346: error: expected a "{"
| __declspec(noreturn) void __cdecl __report_gsfailure(void);
| ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h, line 552: error: identifier "__time64_t" is undefined
| typedef __time64_t time_t;
| ^

Accepted Answer

Anirban
Anirban on 8 Jun 2021
Edited: Anirban on 8 Jun 2021
Visual Studio 2019 is supported from R2021a onwards. See R2021a release notes and the latest page for -compiler. You have to select the value visual16.x for compiler. If you still run into issues, please contact MathWorks Technical Support.
In case the in-product documentation does not give any useful result, you can try searching the online documentation here. The online documentation reflects the latest release and will show you features later than the release you might have. For instance, here is the search result for : "Visual Studio 2019" + Polyspace. The same search in R2020b doc does not give an useful answer since Visual Studio 2019 was not officially supported in R2020b.
  1 Comment
Martin Walker
Martin Walker on 9 Jun 2021
Hi Anirban.
Thanks for the clarification. It has answered my question. I will ask my company to look into upgrading.
Martin

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by