我刚刚下载了http://dev.mysql.com/downloads/mirror.php?id=414392并在 dev c++ 中将 include/bin/lib 文件夹设置为我的编译器(tdm-gcc 4.8.1)。
我可以使用 mysql.h (#include ) 中的函数
但我无法编译程序。bcoz:
undefined reference to `mysql_init'
undefined reference to `mysql_select_db'
我必须做什么?
我刚刚下载了http://dev.mysql.com/downloads/mirror.php?id=414392并在 dev c++ 中将 include/bin/lib 文件夹设置为我的编译器(tdm-gcc 4.8.1)。
我可以使用 mysql.h (#include ) 中的函数
但我无法编译程序。bcoz:
undefined reference to `mysql_init'
undefined reference to `mysql_select_db'
我必须做什么?
You've got the '-L' arguments including the lib directories, but you don't appear to have a '-l' argument linking the actual library. I think what you want to add is '-lmysqlclient' or something similar. Please see the following page for more information:
http://dev.mysql.com/doc/refman/5.0/en/c-api-building-clients.html