Any attempt to compile a .c ( not .cxx) file that includes <windows.h> in a Visual Studio 2019 16.3.5 project using Intel 2019.5 results in the following error
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.23.28105\include\vcruntime_string.h(18): error : expected an attribute name
1> _NODISCARD _Check_return_
workarounds are to compile the offending .c files with the Visual C++ compiler or "compile as C++"
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Parallel Computing
As it is well known Visual C++ 2019 pushes point updates on users quite agressively. Reverting to previous point releases of Visual Studio is very difficult if not impossible as the actual version needed may not be downloadable. The information I am providing is
- useful for other users to avoid the issue
- useful for Intel as they will have to fix the issue in a subsequent release
-useful if Intel has a suggested workaround beyond compiling as C++ or with the Visual C++ compiler.
If you know of a workaround, that would be a helpful comment.
I realize this is a no-win situation for Intel. Some people like the pace of updates of Visual Studio - I am not so sure it really benefits everyone.
Just a question, on Windows,is there a flag to say "compile as C++" when passed a .c file ?
On linux one can use the "-x c++" option, but that does not exist for Windows.
Adding “/Tp” to the additional options list of the command line solves this issue. But a few minor fixes (e.g. explicit casting of the void pointers) will be in order.