C++/CLI程式啟動錯誤 Expression: _CrtIsValidHeapPointer(pUserData)

 

原因

The reason why you get this error is that a winforms application has a managed entry point. The initialization of the native global objects is done by the CRT (C RunTime) startup routine. Since in this case there is no CRT startup routine the MyBoard global object fails to initialize correctly.

IDE is specific the entry of ManagedApp as "main". However, using "main" will bypass a lot of CRT's startup initialization.

 

原理:

 

That should re-enable the CRT startup code which initializes the internal CRT variables.That symbol is really the mangled name for "int __clrcall mainCRTStartupStrArray(cli::array<class System::String ^ >^)".

 

 

網路蒐集之解法一

properties->link->advanced

把Entry Point从main改成 "?mainCRTStartupStrArray@@$$FYMHP$01AP$AAVString@System@@@Z"

 

網路蒐集之解法二

01.project properties -> Linker -> Input -> Force Symbol References 欄位中加入 __DllMainCRTStartup@12
02.將專案的進入點設定成Entry Point to: Yes (/NOENTRY)
    Project Properties -> Linker -> Advanced -> No Entry Point將選項設定成上述內容。

 

網路蒐集之解法三

01.Set Linker/Advanced/Entry Point to "" (empty string)
02.Set Linker/System/Subsystem to Not Set

 

Reference

01.http://www.cnblogs.com/clayman/archive/2010/12/04/1896024.html

02.http://teexit1224.pixnet.net/blog/post/36862043-%5Bc%2B%2B-cli%5D%E5%9F%B7%E8%A1%8C%E9%81%8E%E7%A8%8B%E4%B8%AD%E7%99%BC%E7%94%9F-_crtisvalidheappointer(puserd

 

Thanks for references

 

arrow
arrow
    全站熱搜

    Ping 發表在 痞客邦 留言(0) 人氣()