Search code examples
c++visual-studio-2017header

Including <Windows.h> causes (unknown attribute"no_init_all") error


Title says it all, started a new project in VS2017, included <iostream>, then when I went to include <Windows.h> (This is my first attempt at working with this header by the way), I got the error saying: unknown attribute"no_init_all" Any idea what might be causing this?


Solution

  • OK, putting those comments into an answer ...

    This bug is fixed in VS 2019, but as per this answer, in VS 2017 you can use:

    #define no_init_all deprecated
    

    or even just:

    #define no_init_all
    

    or as mentioned in the comments, switch to an SDK that works. Lets start some lists:

    Working:

    • 10.0.17134.0

    Not working:

    • 10.0.17763.0
    • 10.0.19041.0
    • 10.0.22621.0