vs2010 debug下调试c 程序报错:
Runtime Error! Program: D:\Program Files (x86)\test\test\test.exe R6030 - CRT not initialized
参考https://blog.csdn.net/chenlycly/article/details/12087146介绍,使用windgb查到
//... ModLoad: 0f710000 0f74c000 D:\Program Files (x86)\test\test\libcurl.dll ModLoad: 767c0000 76805000 C:\Windows\syswow64\WLDAP32.dll ModLoad: 6a4f0000 6a5af000 D:\Program Files (x86)\test\test\MSVCR100.dll (23d8.2560): Break instruction exception - code 80000003 (first chance) eax=00000000 ebx=00000000 ecx=e6760000 edx=0014de28 esi=fffffffe edi=00000000 eip=77ec0f74 esp=00baf4c0 ebp=00baf4ec iopl=0 nv up ei pl zr na pe nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000246 *** ERROR: Symbol file could not be found. Defaulted to export symbols for ntdll.dll - ntdll!LdrVerifyImageMatchesChecksum 0xf1f: 77ec0f74 cc int 3 0:000> kn # ChildEBP RetAddr WARNING: Stack unwind information not available. Following frames may be wrong. 00 00baf4ec 77ea0f6f ntdll!LdrVerifyImageMatchesChecksum 0xf1f 01 00baf668 77e69f11 ntdll!LdrVerifyImageMatchesChecksum 0xf1f 01 00baf668 77e69f11 ntdll!RtlUlonglongByteSwap 0x421f 02 00baf6b8 77e59789 ntdll!RtlSetUnhandledExceptionFilter 0x50 03 00baf6c8 00000000 ntdll!LdrInitializeThunk 0x10
发现exe引用的的libcurl.dll是release于是重新编译了一个版本debug版本,覆盖release版的libcurl.dll再次调试后发现不报告CRT not initialized错误了。
总结:1.windbg是好东西,可以定位加载到哪里dll失败;2.如果在程序中混合msvcr100.dll和msvcr100d.dll可能会造成CRT not initialized错误。
参考:https://blog.csdn.net/chenlycly/article/details/120877146
微软官方网站R6030 CRT not initialized错误的解释。微软的网站为:
C 运行时错误 R6030 | Microsoft Docs