Linker Error Undefined Reference To Mysql_init4
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about
Undefined Reference To Mysql_init' C
Stack Overflow the company Business Learn more about hiring developers or posting ads with undefined reference to `mysql_real_connect' us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is mysql h no such file or directory a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Mysql with C++ error: undefined reference to mysql_init up vote 3 down vote favorite 1 #include
Get Kubuntu Get Xubuntu Get Lubuntu Get UbuntuStudio Get Mythbuntu Get Edubuntu Get Ubuntu-GNOME Get UbuntuKylin Ubuntu Code of Conduct Ubuntu Wiki Community Wiki Other Support Launchpad Answers Ubuntu IRC Support AskUbuntu Official Documentation User Documentation Social Media Facebook Twitter Useful Links Distrowatch Bugs: Ubuntu PPAs: Ubuntu Web Upd8: Ubuntu OMG! Ubuntu Ubuntu Insights Planet Ubuntu Activity Page Please read before SSO login Advanced Search Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [SOLVED] undefined reference to mysql_init?? Having an Issue With Posting ? Do you want http://stackoverflow.com/questions/9645844/mysql-with-c-error-undefined-reference-to-mysql-init to help us debug the posting issues ? < is the place to report it, thanks ! Page 1 of 2 12 Last Jump to page: Results 1 to 10 of 14 Thread: undefined reference to mysql_init?? Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode January 13th, 2011 #1 i4ba1 View Profile View https://ubuntuforums.org/showthread.php?t=1666018 Forum Posts Private Message 5 Cups of Ubuntu Join Date Oct 2009 Beans 23 undefined reference to mysql_init?? hai all, I have an error when i compile my code using mysql c API #include
a Bug Impact on me: None Category:MySQL Server: Compiling Severity:S3 (Non-critical) Version:4.1 OS:Microsoft Windows (Windows) https://bugs.mysql.com/bug.php?id=8906 Assigned to: Petr Chardin View Add Comment Files Developer Edit Submission View Progress Log Contributions [2 Mar 2005 21:33] Nils Durner Description: To be able to link against libmySQL.dll, you can generate an import library for GCC using --- dlltool --input-def include/libmySQL.def --dllname lib/libmySQL.dll --output-lib lib/libmysqlclient.a -A --- However, if you try to undefined reference link a test application, the used MySQL function are not found: --- .libs/mysql.o(.text+0x6a): In function `x': mysql.c:217: undefined reference to `mysql_fetch_lengths@4' .libs/mysql.o(.text+0x566): In function `x': mysql.c:255: undefined reference to `mysql_init@4' .libs/mysql.o(.text+0x5c7): mysql.c:268: undefined reference to `mysql_real_connect@32' .libs/mysql.o(.text+0x5e1):mysql.c:277: undefined reference to `mysql_error@4' --- This is because the .def shipped with MySQL doesn't contain undefined reference to mangled function names. The attached patch adds them to the .def file. With it applied, you can link against an import library created with dlltool. How to repeat: 1. Get and install MinGW from www.mingw.org 2. Create an import library for libmysql.dll: --- dlltool --input-def include/libmySQL.def --dllname lib/libmySQL.dll --output-lib lib/libmysqlclient.a -A --- 3. Compile a test application: --- gcc -I/c/mysql/include -L/c/mysql/lib/ mysql.c -o mysql -lmysqlclient --- => linker errors Suggested fix: Apply patch. [2 Mar 2005 21:33] Nils Durner PatchAttachment: mysql_def03.diff (text/x-patch), 2.30 KiB.
[3 Mar 2005 18:03] Nils Durner The dlltool options are wrong, sorry. It has to be: --- dlltool --input-def ../include/libmySQL.def --dllname libmySQL.dll --output-lib libmysqlclient.a -k --- [21 Mar 2005 11:54] Petr Chardin Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.mysql.com/documentation/ and the instructions on how to report a bug at http://bugs.mysql.com/how-to-report.php Additional info: The MinGW's linker err