How to fix unresolved external symbol due to MySql Connector C++?

后端 未结 8 1077
不知归路
不知归路 2020-12-19 03:24

I followed this tutorial http://blog.ulf-wendel.de/?p=215#hello. I tried both on Visual C++ 2008 and Visual C++ 2010. Either static or dynamic, the compiler gave me the same

8条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-19 03:51

    According to MySQL 5.1 Reference Manual if you are using the Version 1.1 of the MySQL Connector C++:
    "get_driver_instance() is now only available in dynamic library builds - static builds do not have this symbol. This was done to accommodate loading the DLL with LoadLibrary or dlopen. If you do not use CMake for building the source code you will need to define mysqlcppconn_EXPORTS if you are loading dynamically and want to use the get_driver_instance() entry point."
    If I understand the previous note correctly, you have to use the dynamic build and define mysqlcppconn_EXPORTS.

提交回复
热议问题