Intel compiler 2019.5 cannot compile a .c file that includes <windows.h> (Visual Studio 2019 16.3.5)

Intel compiler 2019.5 cannot compile a .c file that includes <windows.h> (Visual Studio 2019 16.3.5)

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_
1>  ^

 

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

void test()
{
    printf("Hello world\n");
}

 

workarounds are to compile the offending .c files with the Visual C++ compiler or "compile as C++"

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Please use VS2019 versions which released before the compiler released date

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.

 

 

 

 

Issue is that we can't test the compiler if the version of VS2019 weren't available.

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.

How about /Tp<file>?

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.

Leave a Comment

Please sign in to add a comment. Not a member? Join today