View Single Post
  #1 (permalink)  
Old November 15th, 2006, 04:47 PM
oloeriubogdan oloeriubogdan is offline
Registered User
 
Join Date: Nov 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Connecting to MYSQL from C / C++ ?

I’ve just installed fedora 6.
In my free time I’m trying to work on a project as much as possible. What I want too do is to connect to MySql from C.

I’ve read the MYSQL chapter from Beginning Linux Programming – 3rd edition but it seams that I can’t connect to the mysql from C because I do not have the “mysql.h” library on my system.
The mysql shell utility is working just fin and the actual chapter form the book is not saying anything about what to do in this case.

connect1.c contains the code that I’m trying to compile
Code:
#include <stdlib.h>
#include <stdio.h>
#inlcude “mysql.h”

int main (void)
{
    return 0
}
The compile commands that the book say that shod work in most of the cases are:
Code:
$ gcc -I/usr/include/mysql connect1.c -L/usr/lib/mysql -lmysqlclient -lz -o connect1

ore
Code:
$ gcc -I/usr/include/mysql connect1.c -lmysqlclient -o connect1

The problem is that it was impossible for me too find in my hole directory structure a file cooled mysql.h.



A big inconvenient is that I’m using a dialup connection. The internal modem that I use is a winmodem so “No Linux drivers”. All that I can do is just download from windows the files and then copy them too fedora.

Please do help me.


Reply With Quote