zoukankan      html  css  js  c++  java
  • (转载)ERROR :“dereferencing pointer to incomplete type”是什么错误?

    (转载)http://hi.baidu.com/qkjzsjqsehailte/item/70cb35469878a416886d106b


    “dereferencing pointer to incomplete type”是什么错误?
    I use gcc to compile my C file.
    dereferencing pointer to incomplete type是什么错误?
    -->
    你的指针,有一个类型,这个类型是不完全的。也就是说,你只给出了这个类型的声明,没有给出其定义。你这里的类型多半是结构,联合之类的东西。
    把代码贴上来。

    dereferencing pointer to incomplete type是什么错误?
    这句是定义
    struct sockaddr_in my_addr, their_addr, broadcaster_addr,multicaster_addr;

    这句是主函数中用到的,然后报错。
    broadcaster_addr.sin_addr = *((struct in_addr*)broadcaster_he->;h_addr);
    dereferencing pointer to incomplete type是什么错误?

    估计头文件没有被正确包含。
    -->
    这是声明。
    dereferencing pointer to incomplete type是什么错误?
    呵呵,看了大侠的回复,突然想起原来在VC下写的时候把"netdb.h"的库给注释掉了,难怪报错。

    dereferencing pointer to incomplete type
    的错误也是未包含某些头文件造成的!
    分析数据包:判断通信双方的操作系统、网络信息流量、通过路由的数据包大小、数据包内容。


    以太网:以太网的桢?
            以太网中,数据是以被称为帧的数据结构本为单位进行交换的。
    现在最常用的帧格式MAC V2 

    v2帧的格式:
    (插入8字节)目的地址(6字节)-源地址(6字节)-类型(2字节)-数据(46-1500)-FC(4字节)
    RFC1700:
    ETHER TYPES PROTOCOLS(16进制)
    800 IP
    806 ARP
    8035 REVESE ARP
    809B APPLE TALK
    8137/8138 NOVEL
    814C SNMP
    IP数据报的数据结构:


    4、struct ether_header * eth
    此结构体存储以太网报头信息,其成员如下:
    ether_dhost[6] 接收端的MAC地址
    ether_shost[6] 发送端的MAC地址
    ether_type 上层协议的种类

    struct IP *iph
    ip型结构体在IPh文件中定义,其成员和第一部分讲到的IP数据报结构对应,如下:
    成员名 类型 说明
    ip_hl 4位无符号整数 报头长度
    ip_v 同上 版本,现为4
    ip_tos 8位无符号整数 Type of service
    ip_len 16位无符号整数 数据报长度
    ip_id 同上 标识
    ip_off 同上 数据块偏移和标志
    ip_ttl 8位无符号整数 TTL值
    ip_p 同上 上层协议
    ip_sum 16位无符号整数 检验和
    ip_src in_addr结构体 发送端IP
    ip_dst 同上 接收端IP
    8、struct ether_arp *arph
    ether_arp型结构体成员如下:
    成员名 类型 说明
    ea_hdr arphdr型结构体 报头中地址以外的部分
    arp_sha 8位无符号整数数组 发送端MAC地址
    arp_spa 同上 发送端IP地址
    arp_tha 同上 目标MAC地址
    arp_tpa 同上 目标IP地址

  • 相关阅读:
    当扩展方法和类里定义的方法重名时,会优先调用类里自义的方法
    jquery.uploadify不支持MVC的Authorize
    .NET4中多线程并行方法Parallel.ForEach
    http://twitter.github.com/bootstrap/
    .NET 4.0中使用sqlite
    Extend Html.EditorFor MVC
    Custom Email Attribute在客户端不起作用原因
    使用webpack搭建vue环境
    新浪sae对storage的文档进行读写操作
    jquery+bootstrap插件
  • 原文地址:https://www.cnblogs.com/Robotke1/p/3066492.html
Copyright © 2011-2022 走看看