#include<stdint.h>
#include<netinet/ip.h>
#include<netinet/tcp.h>
int main()
{
struct tcphdr *tcpHdr = ((struct tcphdr*)NULL) ;
struct iphdr *ipHdr = ((struct iphdr*)NULL);
uint8_t offset = (unsigned int)(tcpHdr->doff)*4;
uint16_t port = tcpHdr->dest;
unsigned int hdr_len = (ipHdr->ihl)*4;
return 0;
}
after compilation gcc -std=c99 test1.c:
test1.c: In function ‘main’:
test1.c:13:40: error: dereferencing pointer to incomplete type
test1.c:14:25: error: dereferencing pointer to incomplete type
problem:
1). It is not giving any error for struct iphdr
2). If I don't include -std=c99, it compiles and works fine.