0

I am trying to compile a Qt project with msvc2010 which uses the Windows Media SDK When I try to include the wmsbuffer.h or wmsdkidl.h files, I get errors like these:

C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\wmsbuffer.h(48) : error C2146: syntax error : missing ';' before identifier 'INSSBuffer'
C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\wmsbuffer.h(48) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\wmsbuffer.h(48) : error C2146: syntax error : missing ';' before identifier 'INSSBuffer'
C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\wmsbuffer.h(48) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\wmsbuffer.h(48) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\wmsbuffer.h(48) : error C2086: 'int INSSBuffer' : redefinition
        C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\wmsbuffer.h(48) : see declaration of 'INSSBuffer'

I assumed that the problem was that I didn't have the right include or library paths in my .pro file, but even adding this doesn't help:

win32 {

    INCLUDEPATH += "C:/Program Files/Microsoft SDKs/Windows/v7.1/Include"
    DEPENDPATH += "C:/Program Files/Microsoft SDKs/Windows/v7.1/Include"

    LIBS += -L"C:/Program Files/Microsoft SDKs/Windows/v7.1/lib" -lMscvrtd
    LIBS += -L"C:/Program Files/Microsoft SDKs/Windows/v7.1/lib" -lWmvcore
}

The errors also look like something I'd get with circular inclusion, but I haven't found anything else to indicate that this might be the problem here.

Have I forgotten something really obvious?

watsaig
  • 41
  • 7
  • Have you looked into [this](http://stackoverflow.com/questions/18417942/rdtsc-on-visualstudio-2010-express-c-does-not-support-default-int)? – gibertoni Dec 16 '15 at 17:04

1 Answers1

0

Well, it turns out that the lines causing errors in wmsdkidl.h and wmsbuffer.h all look like this:

typedef interface IWMMediaProps IWMMediaProps;

But the header which defines interface (<objbase.h>) doesn't seem to be included in wmsbuffer.h etc.

Including objbase.h in my own header didn't help, so I've solved my problem with this duct-tape solution:

#define interface struct
#include <wmsdk.h>

Which gets rid of the errors, but generates a lot of warnings due to redefining this keyword...

I'm not entirely sure what is going on or why a library that uses interface doesn't include its definition, though, so if someone can offer a better explanation and/or solution, please feel free to!

watsaig
  • 41
  • 7
  • Did you include or similar? A lot of header files for subsystems assume you've included that first. – jcoder Dec 17 '15 at 13:31
  • @JBB I tried including windows.h, but that didn't help. It is included elsewhere in the project though, so I suppose it's not getting included again in this file, causing these problems. I guess it could be good to include all Windows SDK headers in one place to avoid this kind of issues (I haven't had time to try this solution yet). Thanks! – watsaig Dec 18 '15 at 10:28