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是自动生成的文件啊,怎么会重复定义呢?有谁碰到过这个问题吗?求教!急!!!
...全文
634 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
柠檬公主耶 2017-02-02
  • 打赏
  • 举报
回复
引用 1楼__Clown__ 的回复:
楼主解决这个问题了吗,我现在也遇到这个问题了。
看看头文件的交叉引用
柠檬公主耶 2016-09-26
  • 打赏
  • 举报
回复
这个问题解决了好久,都忘了帖子的事了。具体解决忘了,但是二楼和三楼的答案方向是对的,朝这些方向去找
cocoabird 2016-03-08
  • 打赏
  • 举报
回复
typedef struct rt_info{ char name[24]; char tablename[60]; float realval; int validflag; }rt_info; 这两个不要一样
Pokeeeer 2016-03-07
  • 打赏
  • 举报
回复
看看头文件有没有出现交叉引用的问题
__Clown__ 2016-03-07
  • 打赏
  • 举报
回复
楼主解决这个问题了吗,我现在也遇到这个问题了。

3,881

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧