5 messages in com.mysql.lists.plusplusRe: MySql++ and Compiling
FromSent OnAttachments
Tomppa27 Dec 2000 05:12 
Thimble Smith27 Dec 2000 05:16 
Thimble Smith27 Dec 2000 06:26 
Tomppa27 Dec 2000 06:52 
Tomppa27 Dec 2000 08:24 
Subject:Re: MySql++ and Compiling
From:Thimble Smith (ti@mysql.com)
Date:12/27/2000 06:26:15 AM
List:com.mysql.lists.plusplus

On Wed, Dec 27, 2000 at 04:52:34PM +0200, Tomppa wrote:

My compiler use options like this:

c++ -DHAVE_CONFIG_H -I. -I. -I. -I.. -O0 -g3 -Wall - c main.cpp c++ -O0 -g3 -Wall -0 mysql main.o

To me this not say much.

OK. In that case you need to find a place to learn a bit about how the compiler works. Here's a quick example that should help you get started, though.

Change the second line to:

c++ -Wall -o example_program main.o -L/usr/local/lib -L/path/to/mysql/lib/mysql
-L/path/to/mysql++/lib -lz -lmysqlclient -lsqlplus

You will need to change those paths so they point to the correct directories. There should be a tutorial about running the compiler under Unix somewhere on the net. Maybe a Linux HOWTO....

examples of not defined:

/usr/include/g++-3/stl_vector.h(.text+0X30):undefined reference to 'Mysqlconnection::MysqlConnection(char const *,char const *,char const *,char const *,bool)' /usr/include/g++-3/stl_vector.h(.text+0X56d):undefined reference to 'operator<<(ostream &, mysql_ColData<const_string>const &)' /usr/include/g++-3/stl_vector.h(.text+0X6e1):undefined reference to 'Mysqlconnection::MysqlConnection()'

and so on......................

This is because you didn't tell the linker to use the mysqlclient and sqlplus libraries, so it didn't know where to find the definitions of those routines.

I hope this help you to help me :)

Maybe....

I see that you are not far away from my place(Espoo,Finland)

Yes, for a while I'm in Finland, learning more about MySQL and enjoying a nice hot sauna once in a while.

Tim