mysql.h not found... why not? [C] [MacOSX]
Posted by: Lynsey Schroeder
Date: March 09, 2012 11:27AM


I'm attempting to connect to my MySQL database using a C program, but it isn't making it past the #include <mysql.h> line because it fails the compile when it can't find the header. I'm not sure why it can't find the header, I have it in the same directory as all the other headers (i.e. stdlib.h or stdio.h), which is /usr/include. I put everything from the C Connector into the include, lib, and bin folders within the usr directory.

Can anybody shed some light on this? I'm stuck.

I'm using Mac OSX Lion and xCode.

Here is my program:


int main()
MYSQL *conn;
//MYSQL_RES *res;

char *server ="localhost";
char *user = "lynseysc";
char *password = "";
char *database = "lynseysc_misc";

conn = mysql_init(NULL);

if(mysql_real_connection(conn, server, user, password, database, 0, NULL, 0))
printf("Connected successfully!");
printf("Error connecting.");

return 0;

Options: ReplyQuote

Written By
mysql.h not found... why not? [C] [MacOSX]
March 09, 2012 11:27AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.