I installed mySQL using
sudo apt-get install mySQL-server
then i installed libmysqlclient15-dev using
sudo apt-get install libmysqlclient15-dev
Next, I installed libmysqlC ++ - dev using
sudo apt-get install libmysqlc++-dev
after that I tried to run the following code using
g++ test.c -I/usr/include/mysql -I/usr/include/mysql++
#include <mysql.h>
but I got the following errors:
r@r-desktop :~/mysqlC++$ g++ test.c -I/usr/include/mysql -I/usr/include/mysql++test.c: In function 'int main()': test.c:47:19: warning: deprecated conversion from string constant to 'char*' test.c:48:17: warning: deprecated conversion from string constant to 'char*' test.c:49:21: warning: deprecated conversion from string constant to 'char*' test.c:50:21: warning: deprecated conversion from string constant to 'char*' test.c:56:48: warning: deprecated conversion from string constant to 'char*' /tmp/ccHFL1M4.o: In function `mysql_connection_setup(connection_details)': test.c:(.text+0xf): undefined reference to `mysql_init' test.c:(.text+0x51): undefined reference to `mysql_real_connect' test.c:(.text+0x65): undefined reference to `mysql_error' /tmp/ccHFL1M4.o: In function `mysql_perform_query(st_mysql*, char*)': test.c:(.text+0xa2): undefined reference to `mysql_query' test.c:(.text+0xb6): undefined reference to `mysql_error' test.c:(.text+0xdd): undefined reference to `mysql_use_result' /tmp/ccHFL1M4.o: In function `main': test.c:(.text+0x170): undefined reference to `mysql_fetch_row' test.c:(.text+0x18c): undefined reference to `mysql_free_result' test.c:(.text+0x198): undefined reference to `mysql_close' collect2: ld returned 1 exit status
I believe that I did everything right. Can you guys point out where I'm wrong.
Chani source share