Microsoft KB Archive/50130

= PRB: Linker Error L2041: &quot;Stack Plus Data Exceeds 64K&quot; =

Article ID: 50130

Article Last Modified on 8/31/2005

-

APPLIES TO


 * Microsoft LINK for MS-DOS 3.65
 * Microsoft LINK for MS-DOS 3.69
 * Microsoft LINK for MS-DOS 4.x
 * Microsoft LINK for MS-DOS 5.0x
 * Microsoft LINK for MS-DOS 5.1x
 * Microsoft LINK for MS-DOS 5.2x
 * Microsoft LINK for MS-DOS 5.3x
 * Microsoft LINK for MS-DOS 5.5
 * Microsoft LINK for MS-DOS 5.6
 * Microsoft LINK for OS/2 5.0x
 * Microsoft LINK for OS/2 5.1
 * Microsoft LINK for OS/2 5.11
 * Microsoft LINK for OS/2 5.13
 * Microsoft LINK for OS/2 5.15

-



This article was previously published under Q50130



SYMPTOMS
An attempt to link an application fails and Microsoft LINK generates the following message:

L2041 stack plus data exceeds 64K



CAUSE
The application has more than 64K of stack and data to put into DGROUP (the default data segment).



RESOLUTION
To address this situation, perform one or more of the following three steps:
 * Reduce the stack size for the application.
 * Compile the application in the compact, large, or huge memory model.
 * Use the /Gt compiler option switch or the FAR keyword to remove data from DGROUP and place it into another data segment.



MORE INFORMATION
Even though a nonfatal error indicates a problem in the executable file, LINK produces the executable file, unless linking with the /ONERROR:NOEXE linker switch. /ONERROR:NOEXE is available with Microsoft C/C++ 7.0, and Visual C++ for Windows versions 1.0 and 1.5. Each non- fatal error message has the following format:

location : error L2xxx: messagetext

In a nonfatal error message, the &quot;location&quot; field names the input file associated with the error or &quot;LINK&quot; if there is no input file. If the input file is an object module or library file and it has a module name, the module name is also given, enclosed in parentheses.

