问题:
我们一般像下面这样使用soap
#import "C://Program Files//Common Files//MSSoap//Binaries//mssoap30.dll" /
exclude("IStream", "IErrorInfo", "ISequentialStream", "_LARGE_INTEGER", /
"_ULARGE_INTEGER", "tagSTATSTG", "_FILETIME")
using namespace MSSOAPLib30;
但是编译的时候可能会出现如下编译错误。
编译错误:
.../debug/mssoap30.tlh(201) : error C2146: syntax error : missing ';' before identifier 'Dom'
.../debug/mssoap30.tlh(201) : error C2501: 'IXMLDOMDocumentPtr' : missing storage-class or type specifiers
.../debug/mssoap30.tlh(201) : error C2501: 'Dom' : missing storage-class or type specifiers
.../debug/mssoap30.tlh(203) : error C2146: syntax error : missing ';' before identifier 'Envelope'
.../debug/mssoap30.tlh(203) : error C2501: 'IXMLDOMElementPtr' : missing storage-class or type specifiers
.../debug/mssoap30.tlh(203) : error C2501: 'Envelope' : missing storage-class or type specifiers
.../debug/mssoap30.tlh(205) : error C2146: syntax error : missing ';' before identifier 'Body'
.../debug/mssoap30.tlh(205) : error C2501: 'IXMLDOMElementPtr' : missing storage-class or type specifiers
.../debug/mssoap30.tlh(205) : error C2501: 'Body' : missing storage-class or type specifiers
.../debug/mssoap30.tlh(207) : error C2146: syntax error : missing ';' before identifier 'Header'
.../debug/mssoap30.tlh(207) : error C2501: 'IXMLDOMElementPtr' : missing storage-class or type specifiers
・・・・・・
看一下错误我们一般都会认为这是因为没有包含msxml的dll和头文件导致,但是把mxxml的dll和头包含进来后发现编译错误变了,
变成了:
Error C2872: ‘IXMLDOMNode ‘: ambiguous symbols
解决方法:
1.去掉刚才追加的msxml的dll和头文件
2.tool->Option Include File
SDK头文件的文件夹移到PlatformSDK头文件夹的后面
具体可以看一下下图
修正前
修正后