beric
V2EX  ›  问与答

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

  •  
  •   beric · Jun 14, 2017 · 2371 views
    This topic created in 3247 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
        1
    xz  
       Jun 15, 2017 via Android
    尴尬。又被艾特了
    gnaggnoyil
        2
    gnaggnoyil  
       Jun 15, 2017 via Android
    你这八成是 abi 没兼容吧。检查一下你的库和你自己用的 visual studio 版本是否一致。

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