gsoap问题:soapcpp2编译头文件正常,VC6。0运行工程时报错 soapstub.h 'struct' type redefinition
柠檬公主耶 2015-12-24 04:19:28 头文件定义如下:
//gsoap ns service name: getRtdbValue
//gsoap ns service namespace: http://localhost/getRtdbValue.wsdl
//gsoap ns service location: http://localhost
//gsoap ns service executable: getRtdbValue.cgi
//gsoap ns service encoding: encoded
//gsoap ns schema namespace: urn:getRtdbValue
typedef struct rt_info{
char name[24];
char tablename[60];
float realval;
int validflag;
}rt_info;
int ns__getRtdbValue(rt_info *rcdInfo, int rcdnum,int* result);
工程里只自己写了一个cpp文件,简单调用了定义的函数
#include <stdio.h>
#include <stdlib.h>
#include "stdsoap2.h"
#include "getRtdbValue.h"
#include "getRtdbValue.nsmap"
#include "inter_func.h"
int main(int argc, char* argv[])
{
int m, s;
struct soap getRtdbValue_soap; //创建一个soap
soap_init(&getRtdbValue_soap);
//soap_set_namespaces(&getRtdbValue_soap, getRtdbValue_namespaces);
if (argc < 2)
{
printf("usage: %s <server_port> \n", argv[0]);
exit(1);
}
else
{
m = soap_bind(&getRtdbValue_soap, NULL, atoi(argv[1]), 100); //绑定到相应的IP地址和端口。NULL指本机,atoi(argv[1])为端口号,最后一个参数不重要。
if (m < 0) //绑定出错
{
soap_print_fault(&getRtdbValue_soap, stderr);
exit(-1);
}
fprintf(stderr, "Socket connection successful: master socket = %d\n", m); //绑定成功返回监听套接字
for ( ; ; )
{
s = soap_accept(&getRtdbValue_soap);
if (s < 0)
{
soap_print_fault(&getRtdbValue_soap, stderr);
exit(-1);
}
fprintf(stderr, "Socket connection successful: slave socket = %d\n", s); //绑定成功返回监听套接字
soap_serve(&getRtdbValue_soap);//该句说明该server的服务
soap_end(&getRtdbValue_soap);
}
}
return 0;
}
//server端的实现函数与getRtdbValue.h中声明的函数相同,但是多了一个当前的soap连接的参数
int ns__getRtdbValue(struct soap *getRtdbValue_soap,rt_info *rcdInfo, int rcdnum,int* result){
*result = getRtdbValue(rcdInfo,rcdnum);
return 0;
}
编译的时候出现d:\program files (x86)\vc\oms\soapstub.h(48) : error C2011: 'rt_info' : 'struct' type redefinition
感觉不会重复定义啊!!!soapstub.h是自动生成的文件啊,怎么会重复定义呢?有谁碰到过这个问题吗?求教!急!!!