c++visual-studio-2010msvcrtcritical-sectionstatic-initializer

.crt section? What does this warning mean?


I've got this warning recently (VC++ 2010)

warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators

I'm assuming this is the Critical Section. It's been a while since my Operating Systems course, so I can't really figure out what this means. If I remember right, the Critical Section works with shared resources. So how is this warning related and what does it mean exactly?


Solution

  • No, CRT = C Run Time. It is support library that any program needs to get the job done. Stuff like strcpy() lives there. You get a '.CRT section' in your .obj file when your code contains global variables that need to be initialized before your program starts running. The CRT takes care of that.

    That is nothing unusual. The problem is the linker didn't see the CRT getting linked into your program. You somehow wrote code that didn't have any dependency on the CRT code, other than the initialization requirement. Very strange, never heard of anybody having this issue. Follow the checklist in the documentation to see if one of them matches your case.