beric
V2EX  ›  问与答

vs2012 C++工程使用 mysql 库编译问题

  •  
  •   beric · Jun 14, 2017 · 2798 views
    This topic created in 3429 days ago, the information mentioned may be changed or developed.
    由于工程需要 DEBUG 版本,在官方下了 mysql 的源码和 mysqlcppconn 的源码进行编译生成 DEBUG 版本的静态 LIB 库,然后在自己工程加入这两个库的时候用 DEBUG 编译就报错了。想问一下这个是什么原因导致?谢谢

    1>rcmysqlcpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __cdecl sql::SQLException::getSQLState(void)const " (__imp_?getSQLState@SQLException@sql@@QEBAAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function __catch$?dbconn@rcmysqlcpp@@QEAAHXZ$0
    1>rcmysqlcpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __cdecl sql::SQLException::getErrorCode(void)const " (__imp_?getErrorCode@SQLException@sql@@QEBAHXZ) referenced in function __catch$?dbconn@rcmysqlcpp@@QEAAHXZ$0
    4 replies  •  2017-06-15 19:29:26 +08:00
    xz
    xz
    Jun 15, 2017 via Android
    1
    尴尬。又被艾特了
    gnaggnoyil
    gnaggnoyil
    Jun 15, 2017 via Android
    2
    你这八成是 abi 没兼容吧。检查一下你的库和你自己用的 visual studio 版本是否一致。

    话说现在还用 vs2012 是不是太老了点,好多 cpp 新特性不能用
    beric
    beric
    OP
    Jun 15, 2017
    3
    @xz 报错了……
    beric
    beric
    OP
    Jun 15, 2017
    4
    @gnaggnoyil 嗯,搞好了,因为用了一些第三方库,那些库都要统一编译方式才行
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2580 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 15:11 · PVG 23:11 · LAX 07:11 · JFK 10:11
    ♥ Do have faith in what you're doing.