![]() |
Connecting to MySQL
Hello,
I am still a newbie at Linux, and I am trying to get some C/C++ code to compile and run that will connect to a MySQL database on a Windows 2000 computer on my network. I cannot get any code to compile if I do any more than: #include "/usr/local/mysql/mysql.h" .. .. MYSQL *test; MYSQL_ROW row; MYSQL_RES res; if i try to do mysql_connect() i get the error 'mysql_connect undeclared' I use the compile command: gcc main.o main.cpp -I/usr/local/mysql/include -L/usr/local/mysql/lib -lmysqlclient the include and library files for mysql are in the /usr/local/mysql directory I have not actually installed mysql on the linux box since I am trying to connect to the windows box. Any suggestions? |
read the errors. connection undeclared. Shouldn't there be any parameters for mysql connecting?
|
Sorry, i forgot to say that I did pass everything that was in the tutorial (changed to meet my system specs of course), and I still go the error
|
Check the pathname to that header file -- on my system it's located at /usr/local/mysql/include/mysql/mysql.h. You're probably better off with something like:
#include <mysql/mysql.h> And then your include path looks correct. |
I looked and the actual file mysql.h is at /root/mysql/include so I think I have it going to the right place.
Unless it cannot be in root or something like that. |
I realize that I have a different path other than /root/mysql/include , but i have tried both ways with no luck.
From a friend, I was told that if i install the RPM for mysql it should make a folder in the /usr/local/include, but I have not been able to get it to do that either! |
All times are GMT -5. The time now is 01:45 PM. |