-1
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];
これは私の構造体の定義です。この構造の私のコードはコンパイラで作業していますが、他のモデル用にコンパイルしようとしたときにその表示はopenwrtでCプログラムをコンパイルする
error: 'struct user' has no member named 'ipAddress' error: 'struct user' has no member named '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);
}
}
表示されているコードでは 'struct user'を定義していません。' user'のみ(名前のないstructのtypedefとして)。コードの他の部分で 'user'の代わりに' struct user'を使用していますか? (Cでは、2つは互換性がありません)。 – Dmitri
コンパイラが不平を言っているコードを表示する必要があります。コードは動作しません。 – FredK
エラーを再現する最小限のコードを残すまで、エラーを生成するために必要でないすべてのコードを削除し続けます。 –