List:MySQL++« Previous MessageNext Message »
From:Joe Hudson Date:December 1 2007 12:26am
Subject:linking mysql++ 2.3.2
View as plain text  
Hi!

Having a bit of a problem with  linking version 2.3.2 of mysql++.

I'm using Eclipse on os X 10.4 dual G5.

I get:
g++ -I"/Users/joehudson/Documents/workspace/Wendy/src" -O0 -g3 -Wall -c
-fmessage-length=0 -MMD -MP -MF"src/Wtrader_testing.d"
-MT"src/Wtrader_testing.d" -o"src/Wtrader_testing.o"
"../src/Wtrader_testing.cpp"
/usr/local/include/mysql++/common.h:157: error: 'MYSQL_FIELD' does not name
a type
/usr/local/include/mysql++/connection.h:145: error: 'my_bool' has not been
declared
/usr/local/include/mysql++/connection.h:159: error: expected ',' or '...'
before '&' token
/usr/local/include/mysql++/connection.h:174: error: 'my_bool' has not been
declared
/usr/local/include/mysql++/connection.h:375: error: 'st_mysql_options' does
not name a type
/usr/local/include/mysql++/connection.h:455: error: 'my_ulonglong' does not
name a type
...

These are things defined in mysql.h

The mysql++ 2.3.2 lib builds and installs ok and the example programs seem
to work.

So, it seems somehow when I  build my own program somehow the process is not
including mysql.h.

I had previously been using version 2.2.1 and didn't have this problem.
(the right libraries and headers were being included)
ded

I upgraded to 2.3.2 and made some additions to query.h adding template
functions to take a table name string along with a  SSQLS object.
for insert, update and  replace. e.g.

    template <class T>
    Query& insert(const T& v, const std::string& table)
    {
        reset();

        MYSQLPP_QUERY_THISPTR << std::setprecision(16) <<
                "INSERT INTO " << table << " (" <<
                v.field_list() << ") VALUES (" <<
                v.value_list() << ')';
        return *this;
    }

(I'm using multiple threads and don't want to define a seperate SSQLS for
each thread or put a lock on the .table(str) method between each insert., if
that makes any sense..)

basically since I upgraded and added that (both together, foolishly) I'm
getting the above errors. spent a good few hours looking through the docs,
my code, going back to 2.2.1 (with similar mods to query.h made) and I get
the same errors.

It gets weirder.

If I change the order of my last 3 SSQLS struct definitions from:

    sql_create_3(equity_row, 1, 3,
        string,                currency,
        double,                amount,
        double,                available)

    sql_create_3(accountmanager_row, 1, 3,
        string,                asset, /* is also the table name of the table
for that asset */
        string,                type,
        string,                dealer)

    sql_create_3(currencies_row, 1, 3,
            string,            code,
            string,            country,
            string,            name)

to:

    sql_create_3(currencies_row, 1, 3,
            string,            code,
            string,            country,
            string,            name)

    sql_create_3(equity_row, 1, 3,
        string,                currency,
        double,                amount,
        double,                available)

    sql_create_3(accountmanager_row, 1, 3,
        string,                asset, /* is also the table name of the table
for that asset */
        string,                type,
        string,                dealer)

and do a clean build the errors change to:

g++ -L/usr/local/lib -L/usr/local/mysql-standard-5.0.37/lib/mysql -o
"Wendy"  ./src/Waccountmanager.o ./src/Wcommand.o ./src/Wdbaccess.o
./src/Wdbconpool.o ./src/Wdealer.o ./src/Wgraph.o ./src/Whub.o
./src/Wmarket.o ./src/Wmarket_i.o ./src/Wmoney.o ./src/Woptions.o
./src/Wplugin.o ./src/Wplugin_base.o ./src/Wportfolio.o ./src/Wsignals.o
./src/Wsystem.o ./src/Wtrader.o ./src/Wtypeutils.o ./src/dbaccess_test.o
./libsrc/gnuplot_i.o   -lmysqlpp -lboost_filesystem-1_34
-lboost_thread-mt-1_34 -lmysqlclient
/usr/bin/ld: Undefined symbols:
Wdbaccesstypes::equity_row::names
Wdbaccesstypes::accountmanager_row::names
Wmarket::info(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, Wdbaccesstypes::instinfo&)
Wmarket::quote(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, Wtimediv)
Wmarket_i::bid(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, float, Wtransaction_i&)
Wmarket_i::offer(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, float, Wtransaction_i&)
Wmarket_i::info(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, Wdbaccesstypes::instinfo&)
Wmarket_i::quote(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, Wtimediv)
collect2: ld returned 1 exit status

then if I update the header containing the SSQLS definitions by say putting
another blank line in I get the old erros  at the top of the email.

what the heck is going on!?

I'm quite prepared to accept that I'm doing something stupid, I'd just like
to know what it is!

some clues would be massively appreciated!

has anyone encountered something similar?

thanks,
Joe


-- 
LIVE MUSIC + OTHER PERFORMANCE ART CHARITY FUNDRAISER
Doors 6.30pm - 1st act 7:30pm,  2nd SUNDAY of EVERY month
@ THE TALKING HEADS, PORTSWOOD Rd, SOUTHAMPTON
£3 entrance: all profits to 2 Local Charities. SCRATCH and HAMPSHIRE
AUTISTIC SOCIETY
-----------------------------------------------------------------------------------------------


Contact joe.hudson@stripped for more info.
-------------------------------------------------------
---------------------------------------
Visit http://www.myspace.com/littlecog  for latest details, to post new
events or volunteer for future community action events.

Thread
linking mysql++ 2.3.2Joe Hudson1 Dec
  • Re: linking mysql++ 2.3.2Warren Young1 Dec
    • Re: linking mysql++ 2.3.2Joe Hudson1 Dec
      • Re: linking mysql++ 2.3.2Warren Young3 Dec
        • Re: linking mysql++ 2.3.2Joe Hudson4 Dec
          • Re: linking mysql++ 2.3.2Warren Young4 Dec
            • Re: linking mysql++ 2.3.2Joe Hudson7 Dec
              • Re: linking mysql++ 2.3.2Warren Young7 Dec