>>>>> "hgz" == hgz <hgz@stripped> writes:
hgz> Thimble Smith:
hgz> Thank you very much giveing me much information!
hgz> but still can't compile my source code:test.c
hgz> #include <stdio.h>
hgz> #include <stdlib.h>
hgz> #include "mysql.h"
hgz> #include "chardefs.h"
hgz> #include "dbug.h"
hgz> #include "errmsg.h"
hgz> #include "history.h"
hgz> #include "keymaps.h"
hgz> #include "m_ctype.h.in"
hgz> #include "m_string.h"
hgz> #include "my_sys.h"
hgz> #include "mysql_com.h"
hgz> #include "mysql_version.h"
hgz> #include "readline.h"
hgz> #include "tilde.h"
hgz> int main( int ac, char** av )
hgz> {
hgz> MYSQL *sock,mysql;
hgz> printf("Only a test!");
hgz> if (!(sock = mysql_connect(&mysql,NULL,0,0)))
hgz> {
hgz> fprintf(stderr,"Couldn't connect to
> engine!\n%s\n\n",mysql_error(&mysql));
hgz> perror("");
hgz> exit(1);
hgz> }
hgz> if (mysql_select_db(sock,"test") < 0)
hgz> {
hgz> fprintf(stderr,"Couldn't select database %s!\n%s\n","test",
hgz> mysql_error(sock));
hgz> exit(1);
hgz> }
hgz> }
hgz> use your command:
hgz> gcc -g -I/usr/local/include/mysql test.c -L/usr/local/lib/mysql -lmysqlclient -o
> test
hgz> much error occurs,exam:
hgz> /usr/local/include/mysql/my_sys.h:414:parse error before 'size_s'
hgz> /usr/local/include/mysql/my_sys.h:415:parse error before '*'
hgz> /usr/local/include/mysql/my_sys.h:417:parse error before 'size_s'
hgz> I am anxious for your help!
hgz> Thanks all
Hi!
The problem is that you are including a lot of MySQL development
headers, without the main header 'global.h'
Fix:
Only include the following files:
#include <stdio.h>
#include <stdlib.h>
#include <mysql.h>
Regards,
Monty