List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:June 9 1999 2:55pm
Subject:Re: mysql_real_connect problem??
View as plain text  
At 9:52 AM -0500 6/9/99, April Escamilla wrote:
>Paul,
>
>   Here's a cut from the c code I am using:
>
>    10  int main()
>    11  {
>    12    MYSQL mysql;
>    13
>    14    mysql_init(&mysql);
>    15    if
>(!mysql_real_connect(&mysql,"host","user","passwd","db",0,NULL,0))
>    16    {
>    17      fprintf(stderr, "Failed to connect to database: Error:
>%s\n",mysql_e
>rror(&mysql));
>    18    }
>    19    else
>    20     {
>    21      printf("Connected to database. \n");
>    22     }
>    23  }  //end of main function
>
>
>   Of course, host, user, etc have actual values in the code like ip address
>etc.  I did try to remove arguments from the call and got the following
>error:
>
>>>>"mysql_connect.c", line 11: warning: improper pointer/integer
>combination:
>>arg #5
>>>>i386ld libc.a:  can't find library libmysql.a
>
>  Do you think this is a function problem or is a library missing?
>  If I forgot to include any information at all, please let me know -- I can
>happily provide it for you.

From your earlier description of the problem, it sounds like you should
remove the db argument.  You can check this by looking in mysql.h to see
what the prototype for mysql_real_connect() looks like it.

The link problem (can't find libmysql.a) looks odd to my.  Normally the
library you want to link in is libmysqlclient.a.  Are you specifying
-lmysql on the command?  Try -lmysqlclient instead.  You'll probably
need -L/usr/local/lib/mysql -lmysqlclient (where the path after the -L
indicates the directory your mysql libraries are located - I know
you said you couldn't find libmysql.a, but that's probably because
there isn't one.  At least, I don't have one.)

--
Paul DuBois, paul@stripped
Northern League Chronicles: http://www.snake.net/nl/
Thread
mysql_real_connect problem??April Escamilla9 Jun
  • Re: mysql_real_connect problem??Paul DuBois9 Jun
Re: mysql_real_connect problem??April Escamilla9 Jun
  • Re: mysql_real_connect problem??Paul DuBois9 Jun
Re: mysql_real_connect problem??April Escamilla9 Jun
  • Re: mysql_real_connect problem??Paul DuBois9 Jun
  • Re: mysql_real_connect problem??Michael Widenius9 Jun
Re: mysql_real_connect problem??April Escamilla9 Jun
  • Re: mysql_real_connect problem??Paul DuBois9 Jun
Re: mysql_real_connect problem??April Escamilla9 Jun
  • Re: mysql_real_connect problem??Paul DuBois9 Jun
Re: mysql_real_connect problem??April Escamilla9 Jun
  • Re: mysql_real_connect problem??Sasha Pachev9 Jun
Re: mysql_real_connect problem??April Escamilla9 Jun
  • Re: mysql_real_connect problem??Paul DuBois10 Jun
  • Re: mysql_real_connect problem??Sasha Pachev10 Jun
Re: mysql_real_connect problem??April Escamilla10 Jun
  • Re: mysql_real_connect problem??Sasha Pachev10 Jun
Re: mysql_real_connect problem??April Escamilla10 Jun
Re: mysql_real_connect problem??April Escamilla10 Jun
Re: mysql_real_connect problem??April Escamilla10 Jun
  • Re: mysql_real_connect problem??Sasha Pachev10 Jun
Re: mysql_real_connect problem??April Escamilla10 Jun
  • Re: mysql_real_connect problem??Paul DuBois10 Jun
  • Re: mysql_real_connect problem??Sasha Pachev10 Jun
Re: mysql_real_connect problem??April Escamilla11 Jun
  • Re: mysql_real_connect problem??Sasha Pachev11 Jun