Read the man page for gcc and note the command line switch to point the 
linker at specific libraries, then use those switches on the command line.  
This is a linker error, rather than a compiler error:

Example:
g++ myGreatProgram.cpp -L/usr/mysql/lib -lmysqlclient



On Wednesday 18 July 2001 15:28, David Ayliffe wrote:
> I am having A LOT of trouble compiling the code Simple1.cc which comes
> with the C++ API for Linux
> I have extracted the API to a directory in /root/ and MySQL is installed
> and works in /usr/local/mysql
>
> PLEASE someone please help me compile just this simple program.  What am
> I missing?
>
> When I compile it I include the path to the header files to mysql and of
> the mysql API.
>
> I am running Suse Linux 7.1 professional with Kernel 2.4
> This is what I get when I try and compile it:
>
>
> pc-xxx-31-190-xxx-du:~/mysql++-1.7.9/examples # g++ simple1.cc
> -I/root/mysql++-1.7.9/sqlplusint/ -I/usr/local/mysql/include
> /tmp/ccvKKWW7.o: In function `main':
> /tmp/ccvKKWW7.o(.text+0x30): undefined reference to
> `MysqlConnection::MysqlConnection(char const *, char const *, char const
> *, char const *, bool)'
> /tmp/ccvKKWW7.o(.text+0x55b): undefined reference to `operator<<(ostream
> &, mysql_ColData<const_string> const &)'
> /tmp/ccvKKWW7.o(.text+0x6a2): undefined reference to
> `MysqlConnection::~MysqlConnection(void)'
> /tmp/ccvKKWW7.o(.text+0x80d): undefined reference to
> `MysqlConnection::~MysqlConnection(void)'
> /tmp/ccvKKWW7.o(.rodata+0x1ac): undefined reference to `mysql_date
> type_info node'
> /tmp/ccvKKWW7.o(.rodata+0x1e4): undefined reference to `mysql_time
> type_info node'
> /tmp/ccvKKWW7.o: In function `MysqlDate type_info function':
> /tmp/ccvKKWW7.o(.gnu.linkonce.t.__tf9MysqlDate+0x18): undefined
> reference to `mysql_date type_info function'
> /tmp/ccvKKWW7.o: In function `MysqlTime type_info function':
> /tmp/ccvKKWW7.o(.gnu.linkonce.t.__tf9MysqlTime+0x18): undefined
> reference to `mysql_time type_info function'
> /tmp/ccvKKWW7.o: In function `MysqlRes::~MysqlRes(void)':
> /tmp/ccvKKWW7.o(.gnu.linkonce.t._._8MysqlRes+0x1b): undefined reference
> to `MysqlResUse::~MysqlResUse(void)'
> /tmp/ccvKKWW7.o: In function `MysqlQuery::preview(void)':
> /tmp/ccvKKWW7.o(.MysqlQuery::gnu.linkonce.t.preview(void)+0x1b):
> undefined reference to `SQLQuery::str(SQLQueryParms const &) const'
> /tmp/ccvKKWW7.o: In function `MysqlRes::num_rows(void) const':
> /tmp/ccvKKWW7.o(.MysqlRes::gnu.linkonce.t.num_rows(void) const+0x14):
> undefined reference to `mysql_num_rows'
> /tmp/ccvKKWW7.o: In function `MysqlQuery::store(SQLQueryParms &,
> query_reset)':
> /tmp/ccvKKWW7.o(.MysqlQuery::gnu.linkonce.t.store(SQLQueryParms &,
> query_reset) +0x40): undefined reference to `SQLQuery::str(SQLQueryParms
> const &, query_reset)'
> /tmp/ccvKKWW7.o: In function
> `MysqlFieldNames::MysqlFieldNames(MysqlResUse const *)':
> /tmp/ccvKKWW7.o(.MysqlFieldNames::gnu.linkonce.t.(MysqlResUse const
> *)+0x4d): undefined reference to `MysqlFieldNames::init(MysqlResUse
> const
> *)'
> /tmp/ccvKKWW7.o: In function `MysqlResUse::num_fields(void) const':
> /tmp/ccvKKWW7.o(.MysqlResUse::gnu.linkonce.t.num_fields(void)
> const+0x12): undefined reference to `mysql_num_fields'
> /tmp/ccvKKWW7.o: In function `MysqlRes::fetch_row(void) const':
> /tmp/ccvKKWW7.o(.MysqlRes::gnu.linkonce.t.fetch_row(void) const+0xd8):
> undefined reference to `mysql_fetch_row'
> /tmp/ccvKKWW7.o(.MysqlRes::gnu.linkonce.t.fetch_row(void) const+0xec):
> undefined reference to `mysql_fetch_lengths'
> /tmp/ccvKKWW7.o: In function `MysqlRes::data_seek(unsigned int) const':
> /tmp/ccvKKWW7.o(.MysqlRes::gnu.linkonce.t.data_seek(unsigned int)
> const+0x1c): undefined reference to `mysql_data_seek'
> /tmp/ccvKKWW7.o: In function `MysqlConnection::store(basic_string<char,
> string_char_traits<char>, __default_alloc_template<true, 0> > const &)':
> /tmp/ccvKKWW7.o(.MysqlConnection::gnu.linkonce.t.store(basic_string<char
> ,
> string_char_traits<char>, __default_alloc_template<true, 0> > const
> &)+0x1d): undefined reference to
> `MysqlConnection::store(basic_string<char, string_char_traits<char>,
> __default_alloc_template<true, 0> > const &, bool)'
> /tmp/ccvKKWW7.o: In function `FieldTypes::FieldTypes(MysqlResUse const
> *)':
> /tmp/ccvKKWW7.o(.FieldTypes::gnu.linkonce.t.(MysqlResUse const *)+0x4d):
> undefined reference to `FieldTypes::init(MysqlResUse const *)'
> collect2: ld returned 1 exit status
>
>
>
>
> Please please someone help.   This is REALLY starting to get on my
> nerves now!!
>
> Thanks lots
> David Ayliffe ([EMAIL PROTECTED])
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
> <[EMAIL PROTECTED]> Trouble
> unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to