List:General Discussion« Previous MessageNext Message »
From:Andrew Schmidt Date:September 12 2000 12:05pm
Subject:Re: Compile Problem
View as plain text  
You have to link in the mysqlclient library.

gcc -c test.cpp -I/usr/local/include/mysql
gcc -o test test.o -L/usr/local/lib/mysql -lmysqlclient

thanks,

-- Andrew

----- Original Message -----
From: "Peter Stapley" <pstapley@stripped>
To: <mysql@stripped>
Sent: Tuesday, September 12, 2000 1:00 AM
Subject: Compile Problem


> I am trying to use the C API and I am having a problem compiling. This is
on
> FreeBSD 4.1.
>
> Code:
>
> #include <mysql.h>
> #include <iostream.h>
>
> int main()
> {
>    MYSQL *test;
>    test = mysql_init(NULL);
>    mysql_close(test);
> }
>
> Error:
>  gcc -o test test.cpp -I/usr/local/include/mysql
> /tmp/ccw24840.o: In function `main':
> /tmp/ccw24840.o(.text+0xc): undefined reference to `mysql_init'
> /tmp/ccw24840.o(.text+0x20): undefined reference to `mysql_close'
>
>
> --
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/php/manual.php" before
> posting. To request this thread, e-mail mysql-thread50395@stripped
>
> To unsubscribe, send a message to:
>     <mysql-unsubscribe-aschmidt=targetnet.com@stripped>
>
> If you have a broken mail client that cannot send a message to the above
address(Microsoft Outlook), you can use
http://lists.mysql.com/php/unsubscribe.php
>
>

Thread
Compile ProblemPeter Stapley12 Sep
  • Re: Compile ProblemAndrew Schmidt12 Sep
  • Re: Compile ProblemRyan Wahle12 Sep