Skip to content

Latest commit

 

History

History
42 lines (31 loc) · 1.46 KB

linker-tools-error-lnk1237.md

File metadata and controls

42 lines (31 loc) · 1.46 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Linker Tools Error LNK1237
Linker Tools Error LNK1237
06/29/2022
LNK1237
LNK1237
8722ffa8-096a-4bb0-85f9-f3aa0e10872a

Linker Tools Error LNK1237

during code generation, compiler introduced reference to symbol 'symbol' defined in module 'module' compiled with /GL

Remarks

During code generation, the compiler shouldn't introduce symbols that are later resolved to definitions compiled /GL. symbol is a symbol that was introduced and later resolved to a definition compiled by using /GL.

For more information, see /GL (Whole Program Optimization).

To resolve LNK1237, don't use /GL to compile the symbol, or use /INCLUDE (Force Symbol References) to force a reference to the symbol.

Example

The following sample generates LNK1237. To resolve this error, don't initialize the array in LNK1237_a.cpp and add /include:__chkstk to the link command.

Source file LNK1237_a.cpp:

// LNK1237_a.cpp
int main() {
   char c[5000] = {0};
}

Source file LNK1237_b.cpp:

// LNK1237_b.cpp
// compile with: /GS- /GL /c LNK1237_a.cpp
// processor: x86
// post-build command: (lib LNK1237_b.obj /LTCG & link LNK1237_a.obj LNK1237_b.lib /nodefaultlib /entry:main /LTCG)
extern "C" void _chkstk(size_t s) {}