1

So Ive been following along with a tutorial where I've created a direct x window. Running the tutorials code found here I get a series of errors with the DXGI.h file. Mainly a series of:

C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include\dxgi.h|286|error: '__in' has not been declared|

and

C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include\dxgi.h|286|error: expected ',' or '...' before '&' token|

I ran this on an alternate computer, although the same error occurred. Been going at it for a few hours now and have no idea. I'm using mingw gcc compiler.

23scurtu
  • 138
  • 10
  • What visual studio version are you using when building this malaise ? I believe you need at least CL10 (vs2010 or later) for some of the language additions that are now used in the various SDK file sets. – WhozCraig Feb 21 '15 at 03:18
  • Im using codeblocks atm. – 23scurtu Feb 21 '15 at 03:20
  • That's an IDE. What is the **compiler** toolchain you're using, including versions? (and you may find [this question](http://stackoverflow.com/questions/9000485/how-to-compile-a-directx-11-app-in-mingw) interesting. – WhozCraig Feb 21 '15 at 03:21
  • I tried installing the mingw64 but I have no Idea what files to drag where – 23scurtu Feb 21 '15 at 04:06

1 Answers1

1

Microsoft header files use many of these non-standard qualifiers. Removing them rather not cause any damage.

Try insert this code before first microsoft include.

#ifdef __MINGW32__
#define __in
#define __in_opt
#define __in_bcount(x)
#define __in_z
#define __in_z_opt
#define __inout
#define __out
#define __out_opt
#define __out_bcount(x)
#define __out_bcount_opt(x)
#endif

I'm not 100% sure that it is properly but it works for me. (I use this method in a quite large DirectX program.)

Piotr Siupa
  • 3,929
  • 2
  • 29
  • 65
  • Hmm, that fized my previous errors, but now I'm getting a ton of c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\mingw32\bits\c++locale.h|75|error: expected primary-expression before ',' token| – 23scurtu Feb 21 '15 at 03:44
  • 2
    Those are SAL annotations for the static code analysis tools used internally and externally. The can be safely #defined to nothing, but that actually should happen automatically with the sal.h that's part of the Windows SDK when ``_PREFAST_`` is not defined. – Chuck Walbourn Feb 21 '15 at 07:36