我使用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引用后自动生成的。
------最佳解决方案--------------------------------------------------------
我这里没有2010
2005生成的是
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/>
------其他解决方案--------------------------------------------------------
public delegate System::Void HelloWorldCompletedEventHandler
是否应该为
public delegate Void System::HelloWorldCompletedEventHandler
------其他解决方案--------------------------------------------------------
c++哪来的public void somemethod(){} 定义
c++ 应该
ref class{
public:
void method(){}
}
------其他解决方案--------------------------------------------------------
不是的dbmh, 我修改了也不行.
我在网上找到了这个与我的问题一样, 他意思说已经解决了, 我看不懂他怎么解决的.
http://forums.codeguru.com/archive/index.php/t-410595
------其他解决方案--------------------------------------------------------
可是这些代码是我添加Web引用后自动生成的啊,不是我写的。
------其他解决方案--------------------------------------------------------