[英]Compiling C program with openwrt
typedef struct{
char startDate[12],endDate[12];
short activeFlag: 8;
short ruleNo;
int duration;
time_t end_time;
}usagesOnRule;
typedef struct
{
usagesOnRule timeBaseUsages[TIME_BASED_USG_NUM];
time_t lstChrgngAtmptd;
time_t lastUpdateTime;
time_t lastBlockTime;
long long macKey;
uint32_t ipKey;
uint32_t dropPkt;
uint32_t sessionCnt[QTHREAD_SIZE];
int16_t ruleList[USER_RULE_NO], ruleListCounter;
int sessnStart, sessionNFq, resultCode;
short failCount;
short blocked;
short timeBaseCounter;
char macAddress[MAC_LEN];
char ipAddress[IP_LEN];
}user;
user CurrentUser[USER_NUMBER];
this is my struct definition.这是我的结构定义。 my code with this structure is working with in compiler but when i tried to compile for another model, its showing
我的这种结构的代码正在编译器中使用,但是当我尝试为另一个模型编译时,它显示
error: 'struct user' has no member named 'ipAddress' error: 'struct user' has no member named 'macAddress'
错误:“struct user”没有名为“ipAddress”的成员错误:“struct user”没有名为“macAddress”的成员
..............for all member. ......所有成员。 anyone have idea?
有人有想法吗? I am posting part of my code.
我正在发布我的部分代码。 its huge not possible to post all codes
不可能发布所有代码
for (usrIndx = 0; usrIndx < USER_NUMBER; ++usrIndx)
{
if (CurrentUser[usrIndx].ipKey == 0)
continue;
if (strcmp(CurrentUser[usrIndx].macAddress, msg2) == 0)
{
sessnIndx = CurrentUser[usrIndx].sessnStart;
qIndx = CurrentUser[usrIndx].sessionNFq;
sessionCount = 0;
if (CurrentUser[usrIndx].sessnStart > 0)
{
while (sessnIndx > 0)
{
sessionCount++;
sprintf(reply, "%s%s|%d|%s|%s\n", reply, CurrentSession[qIndx][sessnIndx].destIp, CurrentSession[qIndx][sessnIndx].destPort, CurrentSession[qIndx][sessnIndx].hostName, CurrentSession[qIndx][sessnIndx].appProtocol);
sessnIndx = CurrentSession[qIndx][sessnIndx].next;
}
}
sprintf(reply, "%sTotal_Session_of_%s_%d\n", reply, CurrentUser[usrIndx].macAddress, sessionCount);
}
}
I got the reason behind to not compiling with user structure.我得到了不使用用户结构进行编译的原因。 For Some hardware architecture there is another structure named "User" in kernel module.
对于某些硬件架构,内核模块中有另一个名为“用户”的结构。
Just i renamed my structure name and its working fine.只是我重命名了我的结构名称并且它工作正常。
cheers!干杯!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.