LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1160|回复: 6

求助:QT disigner程序设计

[复制链接]
发表于 2006-5-6 23:11:24 | 显示全部楼层 |阅读模式
请问有人熟悉QT disigner吗?
我的毕业设计要用这个做
以前没怎么用过
现在出问题了
不知道怎么解决
请高手帮帮忙好吗
现在遇到一个奇怪的问题:
我在定义了几个struct
编译的时候老是说重定义
可以确实不存在重定义啊
名字我都改了几个了
还是这样
不解!
QQ:110705838
发表于 2006-5-7 01:13:56 | 显示全部楼层
除了qq你还会啥,贴源码吧,记得格式化
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-5-7 11:08:10 | 显示全部楼层
报的错误是这样的:
def_type.h:7:redefinition of 'struct Modulel::iphdr'
我在def-type.h中定义了struct iphdr
根本没有重定义啊
而且我把iphdr改名字后报同样的错误
谢谢
因为我的linux不能上网
不方便
回复 支持 反对

使用道具 举报

发表于 2006-5-7 12:07:05 | 显示全部楼层
#ifndef filename_h
#define filename_h

#endif
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-5-7 12:50:05 | 显示全部楼层
//def_type.h

typedef struct iphdr{

  unsigned int ip_version :4;         //ip version set to 4

  unsigned int ip_length :4;           //length of ip header in 32_bit words

  unsigned char ip_tos;             //type of service

  unsigned short ip_total_len;         //total length of ip datagram in byte

  unsigned short ip__id;         //destification

  unsigned short ip_flags;         //

  unsigned char ip_ttl;             //time to live

  unsigned char ip_protocal;         //identifies the correct transport protocal

  unsigned short ip_cksum;         //check ip header

  unsigned int ip_source;         //source of the ip datagram

  unsigned int ip_dest;         //destination of the datagram

};

struct tcphdr{

  unsigned short tcp_source_port;

  unsigned short tcp_dest_port;

  unsigned int     tcp_seq;        //sequence of the tcp datagram

  unsigned int tcp_ackno;        //sequence of the next tcp datagram the reveiver expects

  unsigned int tcp_res:6,        //little-endian

              tcp_hlen:4,            //length of tcp header

      tcp_urg:1,            //urgent pointer

      tcp_ack:1,            //acknow
   
            tcp_psh:1,            //push flag

      tcp_rst:1,                //reset flag

      tcp_fin:1;                //finish flag

  unsigned short tcp_winsize;            //maxinum number of bytes able to recieve
  unsigned short

    tcp_cksum;            //checksum of the tcp datagram

  unsigned short tcp_urgent;            //avaible when urg=1

};

struct udphdr{

  unsigned short udp_source_port;

  unsigned short udp_dest_port;

  unsigned int udp_len;                //length of udp datagram

  unsigned int udp_cksum;            //checksum of the udp

};
struct icmphdr{

  unsigned char icmp_type;            //type of icmp

  unsigned char icmp_code;            

};

struct packet{                     //put those msg into the table

  int    ID;
  unsigned int source;

  unsigned int dest;

  char time[9];

  unsigned char ptlk;

  unsigned char *msg;               //other msg such as TTL,sequence,windows size
};

}


*************error*****在别处还没有调用以上的结构

[root@localhost sniffer]# qmake -o makefile sniffer.pro
[root@localhost sniffer]# make
g++ -c -pipe -Wall -W -O2 -

march=i386 -mcpu=i686 -g -DGLX_GLXEXT_LEGACY -fno-use-cxa-atexit -fno-exceptions -DQT_NO_DEBUG -

I/usr/lib/qt-3.1/mkspecs/default -I. -I/usr/lib/qt-3.1/include -I.ui/ -I.moc/ -o .obj/main.o main.cpp
In file included from

main.cpp:4:
def_type.h:7: redefinition of `struct iphdr'

def_type.h:7: previous definition of `struct iphdr'

def_type.h:20: redefinition of `struct tcphdr'

def_type.h:20: previous definition of `struct tcphdr'

def_type.h:36: redefinition of `struct udphdr'

def_type.h:36: previous definition of `struct udphdr'

def_type.h:42: redefinition of `struct icmphdr'

def_type.h:42: previous definition of `struct icmphdr'

def_type.h:46: redefinition of `struct packet'

def_type.h:46: previous definition of `struct packet'

make: *** [.obj/main.o] Error 1
回复 支持 反对

使用道具 举报

发表于 2006-5-9 13:28:59 | 显示全部楼层
用我搞你的方法可以吗
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-5-10 15:55:48 | 显示全部楼层
可以了
非常感谢
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表