gpt4 book ai didi

c++ - 使用 mingw64 c++ "declaration of ' __RPC__range' 无类型编译 imapi2 应用程序时 imapi2.h 中的错误”

转载 作者:太空宇宙 更新时间:2023-11-04 11:38:14 25 4
gpt4 key购买 nike

我正在尝试使用 imapi2 通过在 Windows 上用 mingw 编译的 c++ 程序写入 cd-rw。我正在查看 Visual Studio c++ 示例。我从 Microsoft SDK 7.1 将 imapi2.h 复制到我的项目中,但是当我在我的 header 中包含#include“imapi2.h”并尝试编译时,我从 imapi2.h 文件中得到了一堆错误。我假设这是因为头文件是为 Visual Studio 设置的。有以下错误。 mingw编译器可以使用imapi2吗?谢谢

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,



[. . .]

最佳答案

为了克服这些错误,我发现每个地方都有一个 #include "imapi2.h" 它需要继续 #include rpcsal.h .作为替代方案,在我的系统中,在每个 #include "imapi2.h" 之前的行中添加以下内容也可以。

#define __RC__range(min,max)

#define __RC__in_range(min,max)

关于c++ - 使用 mingw64 c++ "declaration of ' __RPC__range' 无类型编译 imapi2 应用程序时 imapi2.h 中的错误”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22412297/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com