C++/CLI静态链接ISO C++写的动态库,当Debug版本时没有任何问题而改为Release版本后链接时报
fatal error LNK1000: Internal error during IMAGE::BuildImage错误,并弹出如下对话框:
在Output窗体中输出如下错误:
2>e:/.../svcimagereg.h(38) : fatal error C1001: An internal error has occurred in the compiler.
2>(compiler file 'f:/dd/vctools/compiler/utc/src/p2/main.c[0x5114FCA2:0x00000028]', line 182)
2> To work around this problem, try simplifying or changing the program near the locations listed above.
2>Please choose the Technical Support command on the Visual C++
2> Help menu, or open the Technical Support help file for more information
2>LINK : fatal error LNK1000: Internal error during IMAGE::BuildImage
2> Version 9.00.30729.01
2> ExceptionCode = C0000005
2> ExceptionFlags = 00000000
2> ExceptionAddress = 5114FCA2 (51030000) "C:/Program Files/Microsoft Visual Studio 9.0/VC/bin/c2.dll"
2> NumberParameters = 00000002
2> ExceptionInformation[ 0] = 00000001
2> ExceptionInformation[ 1] = 00000028
2>CONTEXT:
2> Eax = 00000000 Esp = 0012EDB0
2> Ebx = 049EB700 Ebp = 0012EDCC
2> Ecx = 00000AD8 Esi = 00000000
2> Edx = 02A69208 Edi = 02A691F0
2> Eip = 5114FCA2 EFlags = 00010216
2> SegCs = 0000001B SegDs = 00000023
2> SegSs = 00000023 SegEs = 00000023
2> SegFs = 0000003B SegGs = 00000000
2> Dr0 = 00000000 Dr3 = 00000000
2> Dr1 = 00000000 Dr6 = 00000000
2> Dr2 = 00000000 Dr7 = 00000000
本项目以前没有任何问题,最近添加了几个抽象类的子类,C++/CLI写的库只依赖于那些抽象基类,对这些实现类没有任何直接的关连关系,也就是对于托管C++库来说是透明的。在增加这些类是对svcimagereg.h文件也没有任何改动。
双击2>e:/.../svcimagereg.h(38) : fatal error C1001: An internal error has occurred in the compiler.
行后定位到一个内联函数上,函数内部是转调vector的empty方法。
将此函数实现部分写到cpp中,也就是不定义为inline函数,build后正常。