MySQL C++ Connector创建会话时崩溃问题求助
环境与配置情况
Windows 10系统,VS 2019环境,项目以DEBUG模式编译,使用DEBUG版本MySQL C++ Connector:
- 已链接
mysqlcppconn8.lib库 - 已将
libcrypto-1_1.dll、libssl-1_1.dll和mysqlcppconn8-2-vs14.dll放入项目目录 - 已添加预处理器宏
STATIC_CONCPP
崩溃复现的最简代码
#include <mysqlx/xdevapi.h> int main() { mysqlx::Session m_DBSession("mysqlx://root@127.0.0.1"); }
崩溃位置
崩溃发生在Session构造函数中:
Session(SessionSettings settings) try : Session_detail(settings) {} CATCH_AND_WRAP
错误信息
抛出多个内存相关异常:
Exception thrown at 0x7620E062 in MainServer.exe: Microsoft C++ exception: cdk::foundation::Error at memory location 0x004EE30C.
Exception thrown at 0x7620E062 in MainServer.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
Exception thrown at 0x7620E062 in MainServer.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
Exception thrown at 0x7620E062 in MainServer.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
Exception thrown at 0x7620E062 in MainServer.exe: Microsoft C++ exception: cdk::foundation::Error at memory location 0x004EE894.
Exception thrown at 0x7620E062 in MainServer.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
Exception thrown at 0x7620E062 in MainServer.exe: Microsoft C++ exception: mysqlx::abi2::r0::Error at memory location 0x004EEAD8.
已尝试的配置调整(均未解决)
- 切换至VS 2017兼容模式编译项目
- 尝试连接器的静态版本与动态版本
- 切换使用
/MD、/MDt、/MDd编译选项 - 更换不同版本的Windows SDK
- 使用RELEASE版本连接器并以RELEASE模式编译项目
内容的提问来源于stack exchange,提问作者Bew Games

