I am trying to use imapi2 to write to cd-rw's with a c++ program that is compiled with mingw on windows. I am looking at a Visual Studio c++ example. I copied imapi2.h to my project from Microsoft SDK 7.1, but when I include #include "imapi2.h" in my header and try to compile I get a bunch of errors from the imapi2.h file. I assume that is because the header file is set up for Visual Studio. There errors are bellow. Is it possible to use mingw compiler to use imapi2? Thanks
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o cdtest.o "..\\cdtest.cpp"
In file included from ..\cdtest.h:7:0,
from ..\cdtest.cpp:2:
..\imapi2.h:17:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning( disable: 4049 ) /* more than 64k source lines */
^
In file included from ..\cdtest.h:7:0,
from ..\cdtest.cpp:2:
..\imapi2.h:1148:35: error: ISO C++ forbids declaration of '__RPC__range' with no type [-fpermissive]
typedef /* [range] */ __RPC__range(0,0xffff) ULONG ULONG_IMAPI2_DVD_STRUCTURE;
^
..\imapi2.h:1148:35: error: typedef '__RPC__range' is initialized (use decltype instead)
..\imapi2.h:1150:35: error: ISO C++ forbids declaration of '__RPC__range' with no type [-fpermissive]
typedef /* [range] */ __RPC__range(0,0xfffffff) ULONG ULONG_IMAPI2_ADAPTER_DESCRIPTOR;
^
..\imapi2.h:1150:35: error: typedef '__RPC__range' is initialized (use decltype instead)
..\imapi2.h:1152:35: error: ISO C++ forbids declaration of '__RPC__range' with no type [-fpermissive]
typedef /* [range] */ __RPC__range(0,0xfffffff) ULONG ULONG_IMAPI2_DEVICE_DESCRIPTOR;
^
..\imapi2.h:1152:35: error: typedef '__RPC__range' is initialized (use decltype instead)
..\imapi2.h:1154:35: error: ISO C++ forbids declaration of '__RPC__range' with no type [-fpermissive]
typedef /* [range] */ __RPC__range(0,0x10002) ULONG ULONG_IMAPI2_DISC_INFORMATION;
^
..\imapi2.h:1154:35: error: typedef '__RPC__range' is initialized (use decltype instead)
..\imapi2.h:1156:35: error: ISO C++ forbids declaration of '__RPC__range' with no type [-fpermissive]
typedef /* [range] */ __RPC__range(0,0x10002) ULONG ULONG_IMAPI2_TRACK_INFORMATION;
^
..\imapi2.h:1156:35: error: typedef '__RPC__range' is initialized (use decltype instead)
..\imapi2.h:1158:35: error: ISO C++ forbids declaration of '__RPC__range' with no type [-fpermissive]
typedef /* [range] */ __RPC__range(0,0x100) ULONG ULONG_IMAPI2_FEATURE_PAGE;
^
..\imapi2.h:1158:35: error: typedef '__RPC__range' is initialized (use decltype instead)
..\imapi2.h:1160:35: error: ISO C++ forbids declaration of '__RPC__range' with no type [-fpermissive]
typedef /* [range] */ __RPC__range(0,0x101) ULONG ULONG_IMAPI2_MODE_PAGE;
^
[. . .]
..\imapi2.h:1194:47: error: expected ')' before numeric constant
/* [range][in] */ __RPC__in_range(6,16) ULONG CdbSize,
^
..\imapi2.h:1194:47: error: expected ')' before numeric constant
..\imapi2.h:1194:46: error: expected ';' at end of member declaration
/* [range][in] */ __RPC__in_range(6,16) ULONG CdbSize,
^
..\imapi2.h:1194:47: error: expected unqualified-id before numeric constant
/* [range][in] */ __RPC__in_range(6,16) ULONG CdbSize,
^
..\imapi2.h:1200:31: error: '__RPC__in_range' has not been declared
/* [range][in] */ __RPC__in_range(6,16) ULONG CdbSize,
[. . .]
In order to get past these errors I found that every place there is a #include "imapi2.h"
it needs to proceeded with a #include rpcsal.h
. As an alternative on my system adding the following to lines before each #include "imapi2.h"
also works.
#define __RC__range(min,max)
#define __RC__in_range(min,max)