Linker Tools Warning LNK4210
.CRT section exists; there may be unhandled static initializers or terminators
Some code introduced static initializers or terminators, but the CRT or its equivalent (which needs to run the static initializers or terminators) isn't run when the application starts. Examples of code that would cause this:
- Global class variable with a constructor, destructor, or virtual function table.
- Global variable initialized with a non-compile-time constant.
To fix this problem:
- Add msvcrtxx.lib, libc.lib, libcd.lib, libcmt.lib, or libcmtd.lib to your linker command line, or
- Remove all code with static initializers.
- Do not use /NOENTRY.
LNK4210 can also occur if:
- The project is created as a managed DLL that contains Microsoft intermediate language code that does not link to native C/C++ libraries such as the CRT, ATL, or MFC, and you add code from a native C/C++ library that uses static variables. To fix, you must convert the project to mixed mode. For more information, see Converting Managed Extensions for C++ Projects from Pure Intermediate Language to Mixed Mode.
- /ENTRY is passed something other than _DllMainCRTStartup. In this case, either remove the /ENTRY linker option, set the entry to _DllMainCRTStartup, or make sure that the DLL entry function calls _CRT_INIT. See Run-Time Library Behavior for more information.
The /GS compiler option requires CRT startup code.