[英]Error: “unknown type name ip4addr_t”
I have a project to generate an IP address using the DHCP protocol. 我有一个使用DHCP协议生成IP地址的项目。 I found code that can help me so I tried to compile it in Ubuntu Linux using gcc
. 我找到了可以帮助我的代码,因此我尝试使用gcc
在Ubuntu Linux中进行gcc
。 It found some errors; 它发现了一些错误; one of them is: 其中之一是:
unknown type name ip4addr_t 未知类型名称ip4addr_t
I don't know if this type is built-in in C, or in some #include
I should add? 我不知道这种类型是否内置在C中,还是应该添加在某些#include
? Or should I create a specific type? 还是应该创建一个特定类型?
This the C code: 这是C代码:
typedef ip4adress_t ipaddr_t;
union ip4addr_t
{
.....
};
Usually, the ip4adress_t
is a typedef to unsigned int
. 通常, ip4adress_t
是unsigned int
的typedef。 However, it is not guaranteed to be the same for all platforms. 但是,并不保证所有平台都相同。
If you indeed mean ip4addr_t
then you wrote yourself that ip4addr_t
is the name of a union. 如果确实是ip4addr_t
那么您自己写了ip4addr_t
是联合的名称。
union ip4addr_t
{
.....
};
So if you get an error that ip4addr_t
is unknown type name then it means that some part of your code does not see this union definition. 因此,如果收到错误ip4addr_t
是未知类型名称,则意味着代码的某些部分看不到该联合定义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.