List:MySQL++« Previous MessageNext Message »
From:Michael Gale Date:March 11 2005 12:59am
Subject:Re: Compile sample on 1.7.31 ?
View as plain text  
Hey,

	Ya ... I tried just running make in the begining ... I believe the 
message was "make ... No needs to be done" or something like that.

Just ran it again and received

"make: *** No rule to make target `../lib/libmysqlpp.la', needed by 
`resetdb'.  Stop."

This is most likely because I ran a make clean and few minutes ago.

If I enable debugging I get:

/tmp/ccnxhejy.o(.text+0x39): In function `main':
/usr/include/c++/3.3.4/sstream:143: undefined reference to 
`connect_to_db(int, char**, mysqlpp::Connection&, char const*)'
/tmp/ccnxhejy.o(.text+0x89): In function `main':
/usr/include/c++/3.3.4/bits/sstream.tcc:191: undefined reference to 
`print_stock_table(mysqlpp::Query&)'
collect2: ld returned 1 exit status

I will build mysql++ again and run make again ...

AHHH ... ok this time all the example binary's where built.

Thanks anyways ...

Michael.


Earl Miles wrote:
> Michael Gale wrote:
> 
>> Hello,
>>
>>     Thanks for the reply ... I am using the copy from the examples 
>> directory, which is different from the one in the documents from the web.
>>
>> The readme in the example directory said the examples should of been 
>> built ? Mine were not :(
>>
>> Anyways ... I tried compiling the simple1.cpp from command line and 
>> got a little further:
>>
>> g++ -I/usr/local/mysql-source/include/mysql 
>> -L/usr/local/mysql-source/lib/mysql -L/usr/local/lib -lmysqlpp 
>> -lmysqlclient simple1.cpp
>>
>> I had to provide the path for the mysqlclient libs, so I also added in 
>> the path for mysqlpp
>>
>> /tmp/ccXfsEPj.o(.text+0x39): In function `main':
>> : undefined reference to `connect_to_db(int, char**, 
>> mysqlpp::Connection&, char const*)'
>> /tmp/ccXfsEPj.o(.text+0x89): In function `main':
>> : undefined reference to `print_stock_table(mysqlpp::Query&)'
>> collect2: ld returned 1 exit status
>>
>> It still seems like it is missing a libaray or something ?
> 
> 
> Those are in util.cpp, so if you're linking it by hand, link with util.o 
> -- but I'm not clear on what's going on. Did you go into the examples 
> directory and just type 'make'?
> 
>>
>> Thanks again ...
>>
>> Michael.
>>
>>
>> Earl Miles wrote:
>>
>>> The example programs should've been included with the package, so you 
>>> shouldn't have needed to copy them from the website. They're in the 
>>> example directory.
>>>
>>> Secondly, you need to convince Anjuta (never used it, so I dunno how) 
>>> to include -lmysqlpp and -lmysqlclient and possibly -L/path/to/mysql 
>>> and -L/path/to/mysqlpp so it can link to the proper library.
>>>
>>> Michael Gale wrote:
>>>
>>>> Hello,
>>>>
>>>> I am running slackware 10 with gcc 3.3.4.
>>>>
>>>> I have build mysql source 4.1.10 successfully and installed it in 
>>>> /usr/local/mysql-source
>>>>
>>>> I then compiled mysql++-1.7.31 with
>>>>
>>>> ./configure --with-mysql=/usr/local/mysql-source/
>>>>
>>>> I then ran reset-db host user password and the database was created. 
>>>> I then copyed the sample from the web site and tried to compile it.
>>>>
>>>> It complained it could not find mysql.h so I added the directory 
>>>> "/usr/local/mysql-source/include/mysql/" to my compilers include path.
>>>>
>>>> I then tried to compile the sample progject simple1.cc and I receive 
>>>> a number of errors. I am using Anjuta 1.2.2 for my IDE.
>>>>
>>>> Anjuta does the following commands:
>>>> g++ -DHAVE_CONFIG_H -I. -I. -I.. 
>>>> -I/usr/local/mysql-source/include/mysql/ -Wall -g -MT main.o -MD -MP 
>>>> -MF ".deps/main.Tpo" -c -o main.o main.cc
>>>>
>>>> which seems to be ok but complains about sqlplus.hh being old and 
>>>> switching to mysql.h and then Anjuta runs:
>>>>
>>>> /bin/sh ../libtool --mode=link g++ -Wall -g -o mysql_plustest main.o
>>>>
>>>> which returns:
>>>>
>>>> --snip--
>>>> g++ -Wall -g -o mysql_plustest main.o
>>>> main.o(.text+0x35): In function `main':
>>>> /usr/include/c++/3.3.4/bits/vector.tcc:119: undefined reference to 
>>>> `mysqlpp::Connection::Connection[in-charge](char const*, char 
>>>> const*, char const*, char const*, bool)'
>>>> main.o(.text+0x4e):/usr/include/c++/3.3.4/bits/vector.tcc:229: 
>>>> undefined reference to `mysqlpp::Connection::query()'
>>>> main.o(.text+0x39b): In function `main':
>>>> /usr/local/include/row.h:258: undefined reference to `vtable for 
>>>> mysqlpp::Row'
>>>> main.o(.text+0x3c2):/usr/local/include/row.h:258: undefined 
>>>> reference to `vtable for mysqlpp::Row'
>>>> main.o(.text+0x43f):/usr/local/include/row.h:260: undefined 
>>>> reference to `vtable for mysqlpp::Row'
>>>> main.o(.text+0x480):/usr/local/include/row.h:260: undefined 
>>>> reference to `vtable for mysqlpp::Row'
>>>> main.o(.text+0x4b9):/usr/local/include/row.h:260: undefined 
>>>> reference to `mysqlpp::operator<<(std::basic_ostream<char, 
>>>> std::char_traits<char> >&, 
>>>> mysqlpp::ColData_Tmpl<mysqlpp::const_string> const&)'
>>>> main.o(.text+0x4cb):/usr/local/include/row.h:260: undefined 
>>>> reference to `mysqlpp::operator<<(std::basic_ostream<char, 
>>>> std::char_traits<char> >&, 
>>>> mysqlpp::ColData_Tmpl<mysqlpp::const_string> const&)'
>>>> main.o(.text+0x4ef):/usr/local/include/row.h:260: undefined 
>>>> reference to `mysqlpp::operator<<(std::basic_ostream<char, 
>>>> std::char_traits<char> >&, 
>>>> mysqlpp::ColData_Tmpl<mysqlpp::const_string> const&)'
>>>> main.o(.text+0x4f8):/usr/local/include/row.h:260: undefined 
>>>> reference to `mysqlpp::operator<<(std::basic_ostream<char, 
>>>> std::char_traits<char> >&, 
>>>> mysqlpp::ColData_Tmpl<mysqlpp::const_string> const&)'
>>>> main.o(.text+0x654): In function `main':
>>>> /home/michael/Projects/mysql_plustest/src/main.cc:56: undefined 
>>>> reference to `mysqlpp::Connection::~Connection [in-charge]()'
>>>> main.o(.text+0x6f3):/home/michael/Projects/mysql_plustest/src/main.cc:56:
> 
>>>> undefined reference to `mysqlpp::Connection::~Connection [in-charge]()'
>>>> main.o(.gnu.linkonce.t._ZN7mysqlpp3RowC1Ev+0x2c): In function 
>>>> `mysqlpp::Row::Row[in-charge]()':
>>>> /usr/local/include/query.h:82: undefined reference to `vtable for 
>>>> mysqlpp::Row'
>>>> main.o(.gnu.linkonce.t._ZN7mysqlpp3RowC1Ev+0x38): In function 
>>>> `mysqlpp::Row::Row[in-charge]()':
>>>> /usr/include/c++/3.3.4/bits/stl_algobase.h:240: undefined reference 
>>>> to `vtable for mysqlpp::Row'
>>>> main.o(.gnu.linkonce.t._ZN7mysqlpp3RowD1Ev+0xc): In function 
>>>> `mysqlpp::Row::~Row [in-charge]()':
>>>> /usr/include/c++/3.3.4/bits/stl_bvector.h:81: undefined reference to 
>>>> `vtable for mysqlpp::Row'
>>>>
> main.o(.gnu.linkonce.t._ZN7mysqlpp3RowD1Ev+0x18):/usr/include/c++/3.3.4/bits/stl_bvector.h:191:
> 
>>>> undefined reference to `vtable for mysqlpp::Row'
>>>> main.o(.gnu.linkonce.t._ZN7mysqlpp6ResultD1Ev+0x1a): In function 
>>>> `mysqlpp::Result::~Result [in-charge]()':
>>>> /usr/include/c++/3.3.4/bits/stl_bvector.h:184: undefined reference 
>>>> to `mysqlpp::ResUse::~ResUse [not-in-charge]()'
>>>> main.o(.gnu.linkonce.t._ZN7mysqlpp5Query7previewEv+0x1b): In 
>>>> function `mysqlpp::Query::preview()':
>>>> /usr/include/c++/3.3.4/bits/stl_bvector.h:539: undefined reference 
>>>> to `mysqlpp::SQLQuery::str(mysqlpp::SQLQueryParms&)'
>>>> main.o(.gnu.linkonce.t._ZN7mysqlpp5Query5storeEv+0x1b): In function 
>>>> `mysqlpp::Query::store()':
>>>> /usr/include/c++/3.3.4/bits/stl_bvector.h:539: undefined reference 
>>>> to `mysqlpp::Query::store(mysqlpp::SQLQueryParms&)'
>>>> main.o(.gnu.linkonce.t._ZN7mysqlpp6ResultD0Ev+0x1a): In function 
>>>> `mysqlpp::Result::~Result [in-charge deleting]()':
>>>> /usr/include/c++/3.3.4/bits/stl_bvector.h:184: undefined reference 
>>>> to `mysqlpp::ResUse::~ResUse [not-in-charge]()'
>>>> main.o(.gnu.linkonce.t._ZNK7mysqlpp6Result8num_rowsEv+0x1f): In 
>>>> function `mysqlpp::Result::num_rows() const':
>>>> /usr/include/c++/3.3.4/bits/stl_bvector.h:107: undefined reference 
>>>> to `mysql_num_rows'
>>>> main.o(.gnu.linkonce.t._ZNK7mysqlpp6Result9fetch_rowEv+0x118): In 
>>>> function `mysqlpp::Result::fetch_row() const':
>>>> /usr/include/c++/3.3.4/bits/sstream.tcc:199: undefined reference to 
>>>> `mysql_fetch_row'
>>>>
> main.o(.gnu.linkonce.t._ZNK7mysqlpp6Result9fetch_rowEv+0x12f):/usr/include/c++/3.3.4/bits/sstream.tcc:136:
> 
>>>> undefined reference to `mysql_fetch_lengths'
>>>> main.o(.gnu.linkonce.t._ZNK7mysqlpp6Result9data_seekEj+0x1d): In 
>>>> function `mysqlpp::Result::data_seek(unsigned) const':
>>>> /usr/include/c++/3.3.4/sstream:201: undefined reference to 
>>>> `mysql_data_seek'
>>>> main.o(.gnu.linkonce.t._ZN7mysqlpp3RowC1EPPcPKNS_6ResUseEPmb+0x35): 
>>>> In function `mysqlpp::Row::Row[in-charge](char**, mysqlpp::ResUse 
>>>> const*, unsigned long*, bool)':
>>>> /usr/include/c++/3.3.4/bits/vector.tcc:119: undefined reference to 
>>>> `vtable for mysqlpp::Row'
>>>> main.o(.gnu.linkonce.t._ZN7mysqlpp3RowC1EPPcPKNS_6ResUseEPmb+0x41): 
>>>> In function `mysqlpp::Row::Row[in-charge](char**, mysqlpp::ResUse 
>>>> const*, unsigned long*, bool)':
>>>> /usr/include/c++/3.3.4/bits/stl_bvector.h:84: undefined reference to 
>>>> `vtable for mysqlpp::Row'
>>>> main.o(.gnu.linkonce.t._ZN7mysqlpp3RowC1EPPcPKNS_6ResUseEPmb+0x1e7): 
>>>> In function `mysqlpp::Row::Row[in-charge](char**, mysqlpp::ResUse 
>>>> const*, unsigned long*, bool)':
>>>> /usr/include/c++/3.3.4/bits/sstream.tcc:162: undefined reference to 
>>>> `mysqlpp::Row::size() const'
>>>> collect2: ld returned 1 exit status
>>>> --snip--
>>>>
>>>> If I switch #include <sqlplus.hh> for #include <mysql++.h>
>>>>
>>>> and run:
>>>>
>>>> g++ -DHAVE_CONFIG_H -I. -I. -I.. 
>>>> -I/usr/local/mysql-source/include/mysql/ -Wall -g -MT main.o -MD -MP 
>>>> -MF ".deps/main.Tpo" -c -o main.o main.cc
>>>>
>>>> I then received:
>>>>
>>>> --snip--
>>>> main.cc: In function `int main()':
>>>> main.cc:12: error: `Connection' undeclared (first use this function)
>>>> main.cc:12: error: (Each undeclared identifier is reported only once 
>>>> for each
>>>>    function it appears in.)
>>>> main.cc:12: error: parse error before `(' token
>>>> main.cc:20: error: `Query' undeclared (first use this function)
>>>> main.cc:23: error: `query' undeclared (first use this function)
>>>> main.cc:26: error: `Result' undeclared (first use this function)
>>>> main.cc:26: error: parse error before `=' token
>>>> main.cc:33: error: `res' undeclared (first use this function)
>>>> main.cc:35: error: `Row' undeclared (first use this function)
>>>> main.cc:35: error: parse error before `;' token
>>>> main.cc:44: error: parse error before `::' token
>>>> main.cc:46: error: `i' undeclared (first use this function)
>>>> main.cc:47: error: `row' undeclared (first use this function)
>>>> --snip--
>>>>
>>>> Anyways ... thanks for any replies ...
>>>>
>>>> Michael.
>>>>
>>>
>>>
>>
> 
> 
Thread
Compile sample on 1.7.31 ?Michael Gale11 Mar
  • Re: Compile sample on 1.7.31 ?Earl Miles11 Mar
    • Re: Compile sample on 1.7.31 ?Michael Gale11 Mar
      • Re: Compile sample on 1.7.31 ?Earl Miles11 Mar
        • Re: Compile sample on 1.7.31 ?Michael Gale11 Mar
      • Re: Compile sample on 1.7.31 ?Warren Young11 Mar