I am getting undefined reference to 'mysql_suchandsuch@#'
messages when trying to link my program with the MySQL libraries supplied with the 5.5 server. When MySQL was installed, I used the default path, which for me on Windows is C:\Program Files\MySQL\MySQL Server 5.5\
. Originally, I had thought that the spaces are causing my grief, but I think I've correctly worked out how to point to the library path without spaces (still with no luck). If there's another probable cause, please let me know.
I have reviewed a series of questions on this site trying to resolve my issue...
Using mingw/g++, I have tried to link using the following options, based on my own research as well as suggestions here:
- -L"C:\Program Files\MySQL\MySQL Server 5.5\lib\" -llibmysql.lib
- -L"C:\Program Files\MySQL\MySQL Server 5.5\lib\" -lmysqlclient.lib
- -L"C:\Progra~1\MySQL\MySQLS~1.5\lib\" -llibmysql.lib
- -LC:\Progra~1\MySQL\MySQLS~1.5\lib\ -lmysqlclient.lib
- -L"C:\Progra~1\MySQL\MySQLS~1.5\lib\" -lmysql
In all cases, I have put the -L
/-l
options at the right-most part of the statement, as I understand this can matter.
I have confirmed the libraries do exist. In the /lib dir, I have libmysql.lib, mysqlclient.lib, and libmysql.dll. I have not tried to link with the .dll, as no tutorial/forum I've reviewed suggested that.
I am not using MAKEFILES.
Does anyone have specific experience with g++/MySQL?