if (WhichLayout == STD_LAYOUT)
{
int num_stand_fields = sizeof(StandardLayout)/sizeof(FirmFieldStruct);
for (int i = 0; i < num_stand_fields; ++i)
{
if (StandardLayout[i].ReportCounts)
{
ReportOnField[StandardLayout[i].Id] = 1;
}
}
}
elseif (WhichLayout == MATCH_LAYOUT)
{
226 int num_match_fields = sizeof(MatchLayout)/sizeof(FirmFieldStruct);
for (int i = 0; i < num_match_fields; ++i)
{
if (MatchLayout[i].ReportCounts)
{
ReportOnField[MatchLayout[i].Id] = 1;
}
}
}
Error:
226: error: invalid application of 'sizeof' to incomplete type 'FirmFieldStruct []'
I'm not sure what is being done wrong here. This is not code I've changed.
Also, why would int num_stand_fields = sizeof(StandardLayout)/sizeof(FirmFieldStruct); be ok but int num_match_fields = sizeof(MatchLayout)/sizeof(FirmFieldStruct); cause an error?
The compiler can't tell the size of an object just from a forward declaration (for obvious reasons: there's nothing there but a name). You'll need to #include the proper header to use that approach.