• VS2010+ICE3.5运行官方demo报错----std::bad_alloc


    纠结了一晚上,在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


  • 相关阅读:
    11
    消除左递归
    4.K均值算法--应用
    3.K均值算法
    2.机器学习相关数学基础作业
    机器算法学习第一次作业
    第十五次作业
    第十四次作业
    第十三次作业
    第十二次作业
  • 原文地址:https://www.cnblogs.com/suncoolcat/p/3333827.html
Copyright © 2020-2023  润新知