#import: Cannot open file "soap12.h" for reading gSoap in VS 2010
Asked Answered
T

1

8

I'm trying to use gSoap2.8 with VS2010 C++ project I declared a pre-build event

wsdl2h.exe -o test.h "test.wsdl"

then it says

error C1083: Cannot open type library file:<path>\stlvector.h: Error loading type library/DLL.  <path>\test.h

So I used -s to get rid of that as follows

wsdl2h.exe -s -o .\test.h "test.wsdl"

but then it say

error : #import: Cannot open file "soap12.h" for reading

How can I get rid of this?

Tourist answered 6/12, 2013 at 6:52 Comment(0)
T
6

The "Error loading type library/DLL" error is from the Visual C++ compiler. That would be caused by an include statement like the following in one of your own files:

#include test.h

To prevent this, just omit that include statement. The .h file that's generated by wsdl2h is only meant to be used by the soapcpp2 program. It's not supposed to be included in your project.

This answer is supported by the following statement from gSOAP's README.txt file:

Do not include the wsdl2h-generated 'calc.h' header file directly into your code (the declarations are replicated in the generated code).

The 'calc.h' file to which that statement refers is a sample file, which in your case corresponds to 'test.h'.

Tsui answered 9/12, 2013 at 14:1 Comment(4)
I used -I to specify the path for import but It still gives the errorTourist
I just realized that the "Error loading type library/DLL" error is from the Visual C++ compiler. That would be caused by an include statement like the following in one of your own files: #include test.hTsui
To prevent this, just omit that include statement. The .h file that's generated by wsdl2h is only meant to be used by the soapcpp2 program. It's not supposed to be included in your project.Tsui
I rewrote the answer in response to your comment -- and hopefully that does solve your problem.Tsui

© 2022 - 2024 — McMap. All rights reserved.