MySQL Forums
Forum List  »  Newbie

Linking C++ app with mysqlclient
Posted by: Olaf van der Spek
Date: September 05, 2004 01:08PM

Hi,

I'm trying to compile and link a C++ app with mysqlclient (on Solaris), but I keep getting errors from the linker.
I downloaded mysql-standard-4.0.20-sun-solaris2.9-sparc-64bit and extracted the include and lib dirs to ../include and ../lib

ls -l ../lib/
-rw------- 1 ovdspek 32080 May 14 03:35 libdbug.a
-rw------- 1 ovdspek 796192 May 14 03:33 libmysqlclient.a
-rw------- 1 ovdspek 821840 May 14 03:27 libmysqlclient_r.a
-rw------- 1 ovdspek 8539398 Sep 5 02:01 libmysqld.a

ls -l
-rw-r--r-- 1 ovdspek 100 Sep 5 21:02 mysql_test.cpp

cat mysql_test.cpp
#include <mysql/mysql.h>

int main()
{
MYSQL h;
mysql_init(&h);
return 0;
}

g++ -I ../include -L ../lib -lmysqlclient mysql_test.cpp
Undefined first referenced
symbol in file
mysql_init /var/tmp/cc1qe2dk.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status

I think it's a simple problem, but I can't find the solution.
Could anybody help me?

Options: ReplyQuote


Subject
Written By
Posted
Linking C++ app with mysqlclient
September 05, 2004 01:08PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.