ID Number: Q66775
5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a
MS-DOS | OS/2
Summary:
A globally declared unsized array in Microsoft C versions 5.1, 6.0,
6.0a, 6.0ax, and C/C++ version 7.0 is considered to be an external
declaration. A module with this type of declaration must be linked
with another .OBJ that contains a declaration for the same global
array, which includes the size, or the following error will be
generated during linking:
L2029: unresolved external
More Information:
Because a global unsized array declaration is considered external, the
C compiler has no way of determining whether the unspecified size was
intentional or a programming error; therefore, no compiler error
message is generated. If it is an error, it will be detected only at
link time. The following code demonstrates this problem:
int Array[];
void main(void)
{
printf("%d.\n", Array);
}
If this code is compiled and linked, the following error will be
generated at link time:
error L2029: '_Array' : unresolved external
However, if a separate object module that declares foo with a size
(for example, "int foo[2]") is linked in with the above code, no LINK
error will be generated.
This behavior is expected and will occur with all Microsoft C and
QuickC compilers.
Additional reference words: 5.00 5.10 6.00 6.00a 6.00ax 7.00