I'm trying to compile a simple program using MySql Connector: Running Simple Query using MinGW. The compilation is successful, and in the linking process the error undefined reference to _imp___ZN3sql5mysql19get_driver_instanceEv , or undefined reference to get_driver_instance() . -LC:/lib/mysql/lib -lmysqlcppconn-static options: -LC:/lib/mysql/lib -lmysqlcppconn-static . In the folder C: / lib / mysql / lib are the library files mysqlcppconn.dll / .lib and mysqlcppconn-static.lib, downloaded from the same site. What am I doing wrong?
|
mysqlcppconn-static.libis a library for MS VS, not for gcc / g ++. The-lmysqlcppconn-staticparameter means that the MinGW linker will search for a file namedlibmysqlcppconn-static.a. You can try to slip this library by renaming it into the one that is expected or just as an object file with an absolute path (without specifying the -l option), but I think the problems will not end there. These connectors have a bad feature - they are tied to a specific version of Visual Studio .. In general, you can try to assemble the connector yourself in MinGW. And take the connector from MariaDB, not MySQL. - Vladimir