At 20:05 -0500 3/6/03, Beau Hartshorne wrote:
I've been working for some time with php and mysql. I've always been
curious, and am finally starting to play with C. I downloaded Paul
DuBois' sample "Chapter 6: The MySQL C API".

I am running Mac OS X 10.2.4. I am running mysql version 3.23.54-max. I
followed the instructions in the sample chapter to get the sample1.c
program to compile.

I ran "mysql_config --cflags" and "mysql_config --libs" to get the right
gcc flags. So I ended up with:

% gcc -c -I'/Library/MySQL/include/mysql' client1.c

When I execute that command, get a terminal full of compile errors
(extra line breaks added):

% gcc -c -I'/Library/MySQL/include/mysql' client1.c

/Library/MySQL/include/mysql/mysql.h:127: undefined type, found
`MEM_ROOT'
/Library/MySQL/include/mysql/mysql.h:168: undefined type, found
`MEM_ROOT'
/Library/MySQL/include/mysql/mysql.h:184: undefined type, found
`MEM_ROOT'

cpp-precomp: warning: errors during smart preprocessing, retrying in
basic mode

In file included from client1.c:4:
/Library/MySQL/include/mysql/mysql.h:127: parse error before "MEM_ROOT"

(and then about 40 more)

The top of the client1.c file looks like this:

/* client1.c - connect to and disconnect from MySQL server */
#include <my_global.h>
#include <mysql.h>

Try changing this to:


/* client1.c - connect to and disconnect from MySQL server */
#include <my_global.h>
#include <my_sys.h>
#include <mysql.h>

and let me know what happens.


So, can anyone tell me what I need to do to compile a simple C program on MacOS X that can connect to a MySQL database? (BTW, I am aware of the Cocoa framework for MySQL, but I am only interested in plain old command-line C for now.)

Thank you,

Beau


---------------------------------------------------------------------
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Reply via email to