[Linker error] undefined reference to `mysql_init@4'
I got a lot of these errors depending on what mysql function I'm calling. Is there any way to fix this? I'm calling the right header file and I'm using Dec-C++. Any help is apprecaited.
[Linker error] undefined reference to `mysql_init@4'
I got a lot of these errors depending on what mysql function I'm calling. Is there any way to fix this? I'm calling the right header file and I'm using Dec-C++. Any help is apprecaited.
You need to link to the mysql library. I'm not sure how to do this with dev-cpp, but someone here can probably tell you.
Wouldn't I have linked the MySQL library since that's the only type of error I get. I have about 20 Linker Errors saying undefined reference to 'mysql_"function"@x'. I also have:
MYSQL *myDatabase = NULL;
and it doesn't return an error. MYSQL is like int or char I believe.
MYSQL *myDatabase = NULL;
That wont give you a link error, because it's probably defined in the header. You will get an error trying to call a function though, because you have to link to the library. Someone needs to tell you how to link to libraries in dev-cpp.
Here, read this:
http://www.dvrsol.com/programming.html#mymingw
scroll down to the part that reads:
MySQL and MinGW (developing MySQL clients in C with Dev-C++)
Oh ok. I understand. I don't know how to link to libraries.Originally Posted by bithub
I found out how and it works. I just get an error when I run the program and thats the part connecting to my database.