我使用VS2010 Pro。
我添加web引用到VC项目,使用/CLR建立时,报错:
error C2059: syntax error : 'public' d:\visual studio 2008
\projects\myproject\myproject\Service1.h 29 MyProject
错误指向代码:
[System::CodeDom::Compiler::GeneratedCodeAttribute(L"wsdl",
L"2.0.50727.1432")]
public delegate System::Void HelloWorldCompletedEventHandler
(System::Object^ sender, Service1::HelloWorldCompletedEventArgs^ e);
Service1.h是我添加web引用后自动生成的。
------解决方案--------------------------------------------------------
public delegate System::Void HelloWorldCompletedEventHandler
是否应该为
public delegate Void System::HelloWorldCompletedEventHandler
------解决方案--------------------------------------------------------
c++哪来的public void somemethod(){} 定义
c++ 应该
ref class{
public:
void method(){}
}
------解决方案--------------------------------------------------------
我这里没有2010
2005生成的是
- C/C++ code
public ref class Service : public System::Web::Services::Protocols::SoapHttpClientProtocol { private: System::Threading::SendOrPostCallback^ HelloWorldOperationCompleted; /// <remarks/> public: event localhost::HelloWorldCompletedEventHandler^ HelloWorldCompleted; /// <remarks/> public: Service(); /// <remarks/> public: [System::Web::Services::Protocols::SoapDocumentMethodAttribute(L"http://tempuri.org/HelloWorld", RequestNamespace=L"http://tempuri.org/", ResponseNamespace=L"http://tempuri.org/", Use=System::Web::Services::Description::SoapBindingUse::Literal, ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] System::String^ HelloWorld(); /// <remarks/> public: System::IAsyncResult^ BeginHelloWorld(System::AsyncCallback^ callback, System::Object^ asyncState); /// <remarks/> public: System::String^ EndHelloWorld(System::IAsyncResult^ asyncResult); /// <remarks/>