[英]gcc dereferencing pointer to incomplete type with c11
I am noob with c.我是 c 的菜鸟。 I have error during compilation with --std=c11 and我在编译时出错 --std=c11 和
#define _XOPEN_SOURCE 600
that is那是
dereferencing pointer to incomplete type
It does not appear with not --std=c11 and define.它不会出现与 not --std=c11 并定义。 My code is like:我的代码是这样的:
struct icmp* icmp;
char send_buffer[BSIZE];
...
icmp = (struct icmp *) send_buffer;
icmp->icmp_type = ICMP_ECHO;
and the error is:错误是:
icmp.c: In function ‘prepare_send_icmp’:
icmp.c:41:6: error: dereferencing pointer to incomplete type
icmp->icmp_type = ICMP_ECHO;
It does not appear with no gcc flag --std=c11 how to repair it?它没有出现没有gcc标志 --std=c11 如何修复它?
您的问题的答案是#define _GNU_SOURCE。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.