PRB: L2029/L2001 Unsized Array Declaration at File Scope [utilities]ID: Q66775
|
An attempt to link an application fails and Microsoft LINK generates the following messages.
With Microsoft C/C++ 16-bit compilers:With Microsoft C/C++ 32-bit compilers:L2029: unresolved externalLNK2001: unresolved external symbol
The application declares an unsized array at file scope, and does not contain another declaration at file scope that specifies the size for the array.
Modify the source code of one of the modules to declare the array with its correct size at file scope.
Because an unsized array declaration at file scope is considered
external, the C compiler cannot determine whether or not the size is
omitted intentionally, and the compiler does not generate an error
message.
The following sample code demonstrates this situation:
int Array[];
void main(void)
{
printf("%d.\n", Array);
}
To address this situation, create another source file that declares
Array to have a size (for example, "int Array[2]"), and compile and
link the two modules.
Additional query words:
Keywords : kbVC100 kbVC150 kbVC200 kbVC500 kbVC600 LinkIss
Version : winnt:1.0,2.0,4.0,5.0,6.0
Platform : winnt
Issue type : kbprb
Last Reviewed: July 14, 1999