【问题标题】:Mongodb Cxx Driver Test crashing in Release Build [ Works fine in Debug ]Mongodb Cxx 驱动程序测试在发布版本中崩溃 [在调试中工作正常]
【发布时间】:2017-07-03 11:10:25
【问题描述】:

我已经按照here 描述的步骤在 Windows 中构建了 mongodb cxx 二进制文件。

我已按照步骤中的说明创建了测试应用程序。 在发布版本上,应用程序抛出bad allocation 异常: std::bad_alloc at memory location 0x0047EB60] 在这一行:

mongocxx::uri muri{ uri_string }; 

同样的代码适用于调试版本。

有人可以帮我解决发布版本中的问题吗?

【问题讨论】:

  • 您能否使用 Visual Studio 的调试器提供错误发生时间的堆栈跟踪?
  • 我在 Release 中构建了 mongocxx 和 bsoncxx 并使用它后,我的问题得到了解决,感谢您的支持
  • 堆栈跟踪:vcruntime140d.dll!59aa4970() 未知 [下面的帧可能不正确和/或丢失,没有为 vcruntime140d.dll 加载符号] [外部代码] > bsoncxx.dll!boost:: basic_string_ref >::to_string() 第 113 行 C++ bsoncxx.dll!bsoncxx::v_noabi::string::view_or_value::terminated() 第 27 行 C++ mongocxx.dll!573b5124() 未知
  • 太棒了!只是为了确保此堆栈跟踪来自您解决问题之前,对吧?

标签: c++ windows mongodb release mongo-cxx-driver


【解决方案1】:

我在 Release 中构建了 mongocxx 和 bsoncxx 并使用它后,我的问题得到了解决。以前我在发布时在调试和测试应用程序中构建了这些。 需要匹配目标配置。

【讨论】:

  • 在 64 中构建 LIBSON:cmake -G "Visual Studio 14 2015 Win64" "-DCMAKE_INSTALL_PREFIX=C:\mongo-c-driver"
  • C 驱动程序 in 64: cmake -G "Visual Studio 14 2015 Win64" "-DCMAKE_INSTALL_PREFIX=C:\mongo-c-driver" "-DBSON_ROOT_DIR=C:\mongo-c-driver"
  • Cxx 驱动程序:cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=C:\mongo-cxx-driver -DCMAKE_PREFIX_PATH=c:\mongo-c-driver -DBOOST_ROOT=C:\boost_1_64_0 -DLIBBSON_DIR=c:\mongo-c-driver -DLIBMONGOC_DIR=c:\mongo-c-driver Win64 : 可选,和c驱动一样
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-12-15
  • 1970-01-01
  • 1970-01-01
  • 2019-12-05
  • 2016-10-19
  • 2013-04-30
  • 1970-01-01
相关资源
最近更新 更多