C++ 是否可以在关闭语言扩展的情况下编写windows和directx代码?

C++ 是否可以在关闭语言扩展的情况下编写windows和directx代码?,c++,windows,directx-9,language-extension,C++,Windows,Directx 9,Language Extension,我的项目已经关闭了扩展名,但必须为任何包含directx或windows标题的cpp文件打开它们 如果我关闭这些cpp文件的扩展名,它将无法编译。有没有办法让它发挥作用 有了语言扩展,它可以很好地编译 我使用VS2012 Express、C++、DUNCTX9和WI7 64。 示例错误 1>c:\program files (x86)\windows kits\8.0\include\um\winnt.h(10907): error C2467: illegal declaration o

我的项目已经关闭了扩展名,但必须为任何包含directx或windows标题的cpp文件打开它们

如果我关闭这些cpp文件的扩展名,它将无法编译。有没有办法让它发挥作用

有了语言扩展,它可以很好地编译

我使用VS2012 Express、C++、DUNCTX9和WI7 64。 示例错误

1>c:\program files (x86)\windows kits\8.0\include\um\winnt.h(10907): error C2467: illegal declaration of anonymous 'struct'

1>c:\program files (x86)\windows kits\8.0\include\um\winnt.h(10918): error C2467: illegal declaration of anonymous 'struct'

1>c:\program files (x86)\windows kits\8.0\include\um\winnt.h(10930): error C2467: illegal declaration of anonymous 'struct'

1>c:\program files (x86)\windows kits\8.0\include\um\winnt.h(10940): error C2467: illegal declaration of anonymous 'struct'

1>c:\program files (x86)\windows kits\8.0\include\um\winnt.h(10950): error C2467: illegal declaration of anonymous 'struct'

1>c:\program files (x86)\windows kits\8.0\include\um\winnt.h(14764): error C2467: illegal declaration of anonymous 'struct'

1>c:\program files (x86)\windows kits\8.0\include\um\winnt.h(15404): error C2467: illegal declaration of anonymous 'struct'

1>c:\program files (x86)\windows kits\8.0\include\um\winnt.h(17421): error C2133: '_ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION::Elements' : unknown size

1>c:\program files (x86)\windows kits\8.0\include\um\wingdi.h(2202): error C2467: illegal declaration of anonymous 'struct'

1>c:\program files (x86)\windows kits\8.0\include\um\wingdi.h(2208): error C2467: illegal declaration of anonymous 'struct'

1>c:\program files (x86)\windows kits\8.0\include\um\wingdi.h(2256): error C2467: illegal declaration of anonymous 'struct'

1>c:\program files (x86)\windows kits\8.0\include\um\wingdi.h(2262): error C2467: illegal declaration of anonymous 'struct'

1>c:\program files (x86)\windows kits\8.0\include\um\wingdi.h(2807): warning C4309: 'initializing' : truncation of constant value

1>c:\program files (x86)\windows kits\8.0\include\um\wingdi.h(2809): warning C4309: 'initializing' : truncation of constant value

1>c:\program files (x86)\windows kits\8.0\include\um\wingdi.h(3008): error C2467: illegal declaration of anonymous 'struct'

1>c:\program files (x86)\windows kits\8.0\include\um\wingdi.h(3048): error C2467: illegal declaration of anonymous 'struct'

1>c:\program files (x86)\windows kits\8.0\include\um\winuser.h(14055): error C2467: illegal declaration of anonymous 'struct'

1>c:\program files (x86)\windows kits\8.0\include\um\winioctl.h(7277): error C2133: '_STORAGE_QUERY_DEPENDENT_VOLUME_RESPONSE::Lev1Depends' : unknown size

1>c:\program files (x86)\windows kits\8.0\include\um\winioctl.h(7278): error C2133: '_STORAGE_QUERY_DEPENDENT_VOLUME_RESPONSE::Lev2Depends' : unknown size

1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\d3d9types.h(88): error C2467: illegal declaration of anonymous 'struct'

1>c:\program files (x86)\microsoft directx sdk (june 2010)\include\d3d9types.h(2070): error C2467: illegal declaration of anonymous 'struct'

Windows标头是在编写时考虑到这些语言扩展的,如果关闭它们,它们将无法编译


您可以做的是重新定义您自己使用的函数和类型,这样您就可以使用Windows API而不必包含其标题。然而,这是一件乏味而痛苦的事情。

在问题中添加了错误消息。顺便说一句,添加的错误消息只是来自使用directx的cpp文件,windows标题给出了其他错误。windows有一些重新制作的DirectX9标题,可与GCC一起使用,我能够成功使用。