Microsoft KB Archive/66775

= You receive &quot;L2029&quot; and &quot;LNK2001&quot; error messages when an attempt to link an application fails =

Article ID: 66775

Article Last Modified on 1/12/2006

-

APPLIES TO

 The Linker (LINK.EXE), when used with:  Microsoft Visual C++ 1.0 Professional Edition

 Microsoft Visual C++ 1.5 Professional Edition

 Microsoft Visual C++ 1.0 Professional Edition

 Microsoft Visual C++ 2.0 Professional Edition</li></ul>

 Microsoft Visual C++ 4.0 Standard Edition</li></ul>

 Microsoft Visual C++ 5.0 Standard Edition</li></ul>

 Microsoft Visual C++ 6.0 Service Pack 5</li></ul>

 Microsoft C Professional Development System 5.1</li></ul>

 Microsoft C Professional Development System 5.1a</li></ul>

 Microsoft C Professional Development System 6.0</li></ul>

 Microsoft C Professional Development System 6.0a</li></ul>

 Microsoft C Professional Development System 6.0a</li></ul>

<ul> <li>Microsoft C Professional Development System 5.1</li></ul>

<ul> <li>Microsoft C Professional Development System 6.0</li></ul>

<ul> <li>Microsoft C Professional Development System 6.0a</li></ul>

<ul> <li>Microsoft C/C++ Professional Development System 7.0</li></ul>

<ul> <li>Microsoft Visual C++ .NET 2003 Standard Edition</li></ul>

<ul> <li>Microsoft Visual C++ .NET 2002 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q66775

<div class="notice_section">

<div class="notice_section">

NOTE: Microsoft Visual C++ NET (2002) supported both the managed code model that is provided by the .NET Framework and the unmanaged native Windows code model. The information in this article applies to unmanaged Visual C++ code only.

<div class="symptoms_section">

SYMPTOMS
An attempt to link an application fails and Microsoft LINK generates the following messages.

With Microsoft C/C++ 16-bit compilers:

L2029: unresolved external

With Microsoft C/C++ 32-bit compilers:

LNK2001: unresolved external symbol

<div class="cause_section">

CAUSE
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.

<div class="resolution_section">

RESOLUTION
Modify the source code of one of the modules to declare the array with its correct size at file scope.

<div class="moreinformation_section">

MORE INFORMATION
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:

Sample Code
int Array[];

void main(void) {  printf(&quot;%d.\n&quot;, Array); } To address this situation, create another source file that declares Array to have a size (for example, &quot;int Array[2]&quot;), and compile and link the two modules.

Keywords: kbprb KB66775

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.