[英]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];
這是我的結構定義。 我的這種結構的代碼正在編譯器中使用,但是當我嘗試為另一個模型編譯時,它顯示
錯誤:“struct user”沒有名為“ipAddress”的成員錯誤:“struct user”沒有名為“macAddress”的成員
......所有成員。 有人有想法嗎? 我正在發布我的部分代碼。 不可能發布所有代碼
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);
}
}
我得到了不使用用戶結構進行編譯的原因。 對於某些硬件架構,內核模塊中有另一個名為“用戶”的結構。
只是我重命名了我的結構名稱並且它工作正常。
干杯!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.