纠结了一晚上,在release版本下运行没问题,一到debug就报错,卡在
Ice::ObjectAdapterPtr adapter = ic->createObjectAdapterWithEndpoints("SimplePrinterAdapter","default -p 10000");
因为本人新手,只能求助google,百度。结果没能用的上的答案。
没办法,只有去官网求助了,终于找到一篇文档,看到标题就泪伤了,希望就这么悄无声息的。
Why does my application work fine in release mode but crash in debug mode?
http://doc.zeroc.com/pages/viewpage.action?pageId=2523181
原文:
The most common reason is a library mix-up. When you build your application in debug mode (that is, with _DEBUG
defined), the compiler uses a debug version of the memory allocation and deallocation functions (see this MSDN page).
When using Ice, memory is sometimes allocated by Ice and deallocated by the application (or vice-versa). You cannot allocate memory with the release version and deallocate this memory with the debug version, therefore it is critical that your application and
the Ice libraries linked with your application use the same heap allocation functions.
The binary Ice distribution on Windows includes both debug and release libraries: use the import libraries with a d
suffix (such as iced.lib
and iceutild.lib
) to link with the debug DLLs.
也就是说,debug模式下,运行的依赖库为
iced.lib
iceutild.lib
是有后缀的lib。
再啰嗦一句,在release模式下,引用的依赖库就是
ice.lib
iceutil.lib