#import:无法在VS 2010中打开文件"soap12.h"来读取gSoap

Thu*_*tne 8 c++ wsdl gsoap visual-studio-2010

我正在尝试将gSoap2.8与VS2010 C++项目一起使用,我宣布了一个预构建事件

wsdl2h.exe -o test.h "test.wsdl"
Run Code Online (Sandbox Code Playgroud)

然后它说

error C1083: Cannot open type library file:<path>\stlvector.h: Error loading type library/DLL.  <path>\test.h
Run Code Online (Sandbox Code Playgroud)

所以我用-s来摆脱如下

wsdl2h.exe -s -o .\test.h "test.wsdl"
Run Code Online (Sandbox Code Playgroud)

但后来它说

error : #import: Cannot open file "soap12.h" for reading
Run Code Online (Sandbox Code Playgroud)

我怎么能摆脱这个?

Spa*_*ter 6

"加载类型库/ DLL错误"错误来自Visual C++编译器.这可能是由您自己的一个文件中的include语句引起的:

#include test.h
Run Code Online (Sandbox Code Playgroud)

为了防止这种情况,只需省略include语句即可.由wsdl2h生成的.h文件仅供soapcpp2程序使用.它不应该包含在您的项目中.

gSOAP的README.txt文件中的以下语句支持此答案:

不要将wsdl2h生成的'calc.h'头文件直接包含在您的代码中(声明在生成的代码中复制).

该语句引用的'calc.h'文件是一个示例文件,在您的情况下对应于'test.h'.