I don't know at which point it stopped working, since I've been using Code::Blocks and MinGW for the last month or so. Nonetheless, almost all of my MSVC projects (and new ones as well) have stopped working altogether now that I opened up Visual Studio again, and every time I try to build them I get hundreds of errors in the Windows API headers.
The first and most common (list of many) problems I get is coming from windows.h, after which inclusion I get this:
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\winnt.h(3606): warning C4103: 'c:\program files (x86)\microsoft visual studio 10.0\vc\include\winnt.h' : alignment changed after including header, may be due to missing #pragma pack(pop)
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\winnt.h(3908): warning C4103: 'c:\program files (x86)\microsoft visual studio 10.0\vc\include\winnt.h' : alignment changed after including header, may be due to missing #pragma pack(pop)
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\winnt.h(4006): warning C4068: unknown pragma
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\winnt.h(4012): warning C4068: unknown pragma
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\winnt.h(4019): warning C4068: unknown pragma
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\winbase.h(1482): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\winbase.h(1482): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\winbase.h(1483): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\winbase.h(1483): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\winbase.h(1483): error C2086: 'int DECLSPEC_NORETURN' : redefinition
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\winbase.h(1482) : see declaration of 'DECLSPEC_NORETURN'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\winbase.h(1543): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\winbase.h(1543): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\winbase.h(1543): error C2086: 'int DECLSPEC_NORETURN' : redefinition
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\winbase.h(1482) : see declaration of 'DECLSPEC_NORETURN'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\rpcdce.h(369): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\rpcdce.h(369): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\rpcdce.h(369): error C2086: 'int DECLSPEC_NORETURN' : redefinition
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\winbase.h(1482) : see declaration of 'DECLSPEC_NORETURN'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\rpcdcep.h(89): error C3646: 'I_RpcAllocate' : unknown override specifier
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\rpcdcep.h(89): error C2091: function returns function
...
etc. etc. (full compilation output here)
This is similar, if not the same problem, to some I've found over the web, but still couldn't find any suitable solution out of:
- http://www.jenkinssoftware.com/forum/index.php?topic=4877.0;wap2
- http://ogre3d.org/forums/viewtopic.php?f=2&t=26302
- https://social.msdn.microsoft.com/Forums/vstudio/en-US/0c97c9ed-c6a0-4f35-8bbf-33203e227f68/setting-up-windowsh-not-found?forum=vcgeneral
- https://social.msdn.microsoft.com/Forums/vstudio/en-US/6cc0cfe6-2c59-4925-bdda-2920a0f7245b/big-time-problems-with-headers?forum=vclanguage
- https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/06ca7ef8-6567-4968-99d3-d989cdcb1b8c/help-errors?forum=vcgeneral
- http://irrlicht.sourceforge.net/forum/viewtopic.php?f=1&t=17147
- http://forums.codeblocks.org/index.php?topic=4508.0
- https://www.c-plusplus.net/forum/167678-full (German link)
- https://www.spieleprogrammierer.de/11-hilfe-zum-buch-3d-spieleprogrammierung-von-david-scherfgen/3719-mal-wieder-fehler/ (German link)
- https://zakimirza.wordpress.com/2007/03/04/setting-up-sdl-opengl-in-visual-studio/ (in a comment under the article)
It also quite reminds me of the problems I had when (dumbly) trying to compile from MSVC using the MinGW inclusions/libraries some time ago - though everything was still working properly at that point - so the best I can think of, it might be a similar issue, as in the headers became incompatible for some reason. Therefore, I thought, maybe I've installed a Win64 version over them without realizing?
I currently have MS Visual Studio 2010 Express, MS Visual Studio 2013 Express, Code::Blocks (with MinGW) and DevC++ installed. The only thing that changed in this period is that I tried out VS 2010 Ultimate (uninstalled shortly later after the trial expired) to try out some extensions, but everything worked just fine in the meanwhile, I don't know why it suddenly stopped working.
I've tried to uninstall and reinstall MSVC, Windows SDK and the DirectX SDK, but nothing worked. The environmental variables look fine, but maybe I haven't checked properly.
All the projects are in the same working state I've left them in, the environment being Win32 and all the inclusion paths being the same as before.
I really have no clue as what to do!
EDIT:
Both empty projects and simple "Hello World!" programs compile & run correctly. As soon as I #include <windows.h>
however, the compilation problems appear.