--- In [email protected], Thomas Hruska <[EMAIL PROTECTED]> wrote: > > Arthur Tumanyan wrote: > > Hi!I have some troubles with variable declarations. > > > > I can't access variables declared in included header file(s). > > For instance: > > ----header file-------------- > > #include <stdio.h> > > #include <stdarg.h> > > #include <stdlib.h> > > #include <ctype.h> > > #include <string.h> > > #include <mysql.h> > > #include <sys/types.h> > > #include <time.h> > > const char MYSQL_ERR[255]; > > .................etc > > ---------source file---------------------- > > #include "header.h" > > > > int db_connect(char *dbhost,char *dbuser,char *dbpwd, > > char *dbname,unsigned int dbport){ > > > > mysql_init(&mysql); > > connection = > > mysql_real_connect( &mysql, dbhost, > > dbuser,dbpwd,dbname,dbport,NULL,0); > > /* check for connection error */ > > if(connection == NULL) { > > /* log the error message */ > > snprintf(MYSQL_ERR,Q_LINE_MAXLEN,"%s\n",(char > > *)mysql_error(&mysql)); > > log_debug(MYSQL_ERR); /* logger function */ > > return 1; > > } > > > > return 0; > > } > > -------------------------------------------- > > after compiling: > > shaga.c: In function `db_connect': > > shaga.c:13: warning: implicit declaration of function `mysql_init' > > shaga.c:14: warning: implicit declaration of function > > `mysql_real_connect' > > shaga.c:14: warning: assignment makes pointer from integer > > without a cast > > shaga.c:18: warning: implicit declaration of function > > `mysql_error' > > It looks like the #include <mysql.h> isn't being included at all - > perhaps there is another header.h file on your system path?
I dare to suppose that <mysql.h> is not in the path for system header files. You might want to try #include "mysql.h" Or you will have to name the directory where mysql.h is stored to the compiler, e.g. using "-I/opt/mysql/include" (or wherever you have stored the header file on your machine). Regards, Nico
