Hi all;
When I run the example in its original directory, I have no problems.
When I wrap the example in my source, the source compiles but fail to
link with a certain Library as shown in the output below. What I want is
to get out the query results and use them in normal C++ environment.
Your help will be greatly appreciated. I am using linux Redhad version
6.2
and mysql++ version 1.7.8

Thanx in advance
Tiwonge

This is my compiler output

g++ -W -Wall -Wpointer-arith -pipe -D_POSIX_THREADS
-D_POSIX_THREAD_SAFE_FUNCTIONS -D_REENTRANT -DACE_HAS_AIO_CALLS -O3 -g
-Wno-uninitialized -fno-implicit-templates  
-I/home/ACE/ACE_wrappers/TAO/orbsvcs -I/home/ACE/ACE_wrappers/TAO 
-I/usr/include/mysql -I/home/tiwonge/broker/broker_idl
-I/home/tiwonge/retailer/implementation_TAO/Utils  -I/usr/include/mysql
-I/usr/local/mysql++/sqlplusint/.libs -I/usr/local/mysql++/sqlplusint
-I/usr/lib/mysql/include     -I/home/ACE/ACE_wrappers
-DACE_HAS_EXCEPTIONS     -L/home/ACE/ACE_wrappers/TAO/orbsvcs/orbsvcs 
-L/home/ACE/ACE_wrappers/TAO/tao -L/usr/lib/mysql/lib  -L./../broker_idl
-L/home/tiwonge/retailer/implementation_TAO/Utils   -L/usr/lib/mysql
-L/home/ACE/ACE_wrappers/ace -L./ -o supplierServer
.obj/supplierServer.o libsupplier.a -lTAO_CosTrading -lTAO_CosNaming
-lTAO_DynamicAny -lTAO_PortableServer -lTAO -lz -lmysqlclient
-lsupplier_idl -lsqlplus  -lTINAUtils -lACE -ldl -lpthread -lrt
libsupplier.a(i_QueryDb_i.o): In function
`i_QueryDb_i::getMessage(short, char const *, supplier::logInInfo const
&, supplier::messageInfo_out)':
/usr/local/mysql++/sqlplusint/connection1.hh:120: undefined reference to
`void MysqlConnection::storein_sequence<vector<stock,
__default_alloc_template<true, 0> > >(vector<stock,
__default_alloc_template<true, 0> > &, basic_string<char,
string_char_traits<char>, __default_alloc_template<true, 0> > const &)'
collect2: ld returned 1 exit status
make: *** [supplierServer] Error 1


This is my makefile


MAKEFILE = Makefile

BIN2 =    supplierServer supplierClient updatedb getmessage

LIBNAME  = libsupplier
LIB2 = $(LIBNAME).a
#SHLIB2 = $(LIBNAME).$(SOEXT)

ifndef TAO_ROOT
  TAO_ROOT = $(ACE_ROOT)/TAO
endif

FILES   = i_InitialiseDb_i\
          i_UpdateDb_i\
          i_QueryDb_i


BROKER_ROOT = $(HOME)/broker
MYSQLCLIENT_ROOT =/usr/local/mysql++
MYSQL_ROOT = /usr/lib/mysql


LDFLAGS += -L$(TAO_ROOT)/orbsvcs/orbsvcs  -L$(TAO_ROOT)/tao
-L$(MYSQL_ROOT)/lib  -L./../broker_idl
-L$(HOME)/retailer/implementation_TAO/Utils   -L/usr/lib/mysql
CPPFLAGS +=  -I$(TAO_ROOT)/orbsvcs -I$(TAO_ROOT)  -I/usr/include/mysql
-I$(BROKER_ROOT)/broker_idl -I$(HOME)/retailer/implementation_TAO/Utils 
-I/usr/include/mysql -I$(MYSQLCLIENT_ROOT)/sqlplusint/.libs
-I$(MYSQLCLIENT_ROOT)/sqlplusint -I$(MYSQL_ROOT)/include

LSRC    = $(addsuffix .cpp,$(FILES))
PSRC    = $(addsuffix .cpp,$(BIN2))

#ACE_SHLIBS += -lTAO_CosTrading -lTAO_CosNaming -lTAO_DynamicAny
-lTAO_PortableServer -lTAO -lACE -lTINAUtils
LDLIBS  += -lTAO_CosTrading -lTAO_CosNaming -lTAO_DynamicAny
-lTAO_PortableServer -lTAO -lz -lmysqlclient -lsupplier_idl -lsqlplus 
-lTINAUtils

CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS)
$(LDFLAGS) -o $@

#----------------------------------------------------------------------------
#       Include macros and targets
#-------------------------------------------------------------------------

ifeq ($(ACE_HAS_GNUG_PRE_2_8),1)

  # Since older g++ cannot handle nested classes properly, this test
  # will not build on g++ prior to 2.8.0.
  all clean realclean:
        @echo Trading tests is not built with older versions of g++

else # ! ACE_HAS_GNUG_PRE_2_8


include $(TAO_ROOT)/rules.tao.GNU

#### If the TAO orbsvcs library wasn't built with sufficient components,
#### don't try to build here.
TAO_ORBSVCS := $(shell sh $(ACE_ROOT)/bin/ace_components --orbsvcs)
#ifeq (Trader,$(findstring Trader,$(TAO_ORBSVCS)))
  BIN = $(BIN2)
  LIB = $(LIB2)
  SHLIB = $(SHLIB2)
#endif # Trader

include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
include $(ACE_ROOT)/include/makeinclude/macros.GNU
include $(TAO_ROOT)/rules.tao.GNU
include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU
include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
#include $(TINA_ROOT)/make.tina.GNU

.PRECIOUS: i_InitialiseDb_i.o supplierServer.o

ifneq ($(BIN),)
  ifeq ($(SHLIB), $(findstring $(SHLIB), $(BUILD)))
    $(BIN): $(SHLIB)
  endif
  ifeq ($(LIB), $(findstring $(LIB), $(BUILD)))
    $(BIN): $(LIB)
  endif
endif # BIN

realclean: clean
        -$(RM) $(foreach file, $(IDL_FILES), $(foreach ext, $(IDL_EXT),
$(file)$(ext)))

endif # ! ACE_HAS_GNUG_PRE_2_8



This is my source


#include "orbsvcs/orbsvcs/CosNamingC.h"
#include "i_QueryDb_i.h"
#include <sqlplus.hh>
#include "stream.h"
#include <vector>
#include "stdlib.h"
#include <iostream>
#include <iomanip>
#include <custom.hh>
//#include "util.hh"

sql_create_5(stock, 1, 5, string, item, longlong, num,
             double, weight, double, price, Date, sdate)



void i_QueryDb_i::getMessage (
                supplier::supplierId id,
                const char * suppname,
                const supplier::logInInfo & logininf,
                supplier::messageInfo_out msginfo
                )
                ACE_THROW_SPEC ((
                CORBA::SystemException
                ))      

{

try {                         // its in one big try block
    Connection con (use_exceptions);
    con.connect ("mysql_cpp_data", "localhost", "root", "tiwonge");
    Query query = con.query ();
    query << "select * from stock";

    vector < stock > res;
    query.storein (res);
    
    cout.setf (ios::left);
    cout << setw (17) << "Item"
         << setw (4) << "Num"
         << setw (7) << "Weight"
         << setw (7) << "Price"
         << "Date" << endl
         << endl;
   

    cout.precision(3);
    vector <stock>::iterator i;
    for (i = res.begin (); i != res.end (); i++) {
      cout << setw (17) << i->item.c_str ()
           << setw (4) << i->num
           << setw (7) << i->weight
           << setw (7) << i->price
           << i->sdate
           << endl;
    }
    return 0;

  } catch (BadQuery er){ // handle any connection
                         // or query errors that may come up
    cerr << "Error: " << er.error << endl;
    return -1;

  } catch (BadConversion er) {
       cerr << "Error: Tried to convert \"" << er.data << "\" to a \""
         << er.type_name << "\"." << endl;
    return -1;
  }
}



  Tiwonge Kawonga 
                                               
<[EMAIL PROTECTED]>
  Telecomunications Engineering Research Programme, School of
  Electrical and Information Engineering, University of the
  Witwatersrand, Johannesburg

---------------------------------------------------------------------
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 <mysql-unsubscribe-##L=##[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to