This is a very common compiler error with the C++ applications using the /clr switch. Here is the compiler output
错误 2 error C3699: “*”: 不能在类型“IServiceProvider”上使用此间接寻址 c:/program files/microsoft sdks/windows/v6.0a/include/servprov.h 96 ViComAPIBridgeDLL
错误 3 error C2371: “IServiceProvider”: 重定义;不同的基类型 c:/program files/microsoft sdks/windows/v6.0a/include/servprov.h 103 ViComAPIBridgeDLL
... ... ...
错误 8 error C2872: “IServiceProvider”: 不明确的符号 C:/Program Files/Microsoft SDKs/Windows/v6.0A/include/urlmon.h 5856 ViComAPIBridgeDLL
The problem is the
#include <windows.h>
using namespace System;
directives. The first one is in conflict with the second.
To resolve the error, just swap their places like that
using namespace System;
#include <windows.h>
本文解决了一个常见的C++混编错误,当使用/clr开关时会出现与IServiceProvider相关的编译错误。错误源自于包含指令和命名空间使用的顺序冲突。通过调整这两条指令的顺序可以解决此问题。

9356

被折叠的 条评论
为什么被折叠?



