La respuesta a tu primera pregunta la puedes deducir si incluyes -I. en
CXXFLAGS y no sustituyes las "" por los <>.
Un saludo,
David.
El mié, 14-11-2007 a las 23:18 +0100, Manuel David Jiménez Patiño
escribió:
> Ea! pos ya he solucionado el problema.
>
> Claro, yo en el makefile ponía el StringIntMap.o en el siguiente sitio:
>
>
>
> CXXFLAGS=-Igenerated
>
> all: Server Server2 Client
>
>
> Server: LDLIBS=-lIce -lFreeze
> Server: Server.o StringIntMap.o generated/Hello.o
> Server.o: Server.cc generated/Hello.h
>
> Server2: LDLIBS=-lIce -lFreeze
> Server2: Server2.o StringIntMap.o generated/Hello.o
> Server2.o: Server2.cc generated/Hello.h
>
> Client: LDLIBS=-lIce
> Client: Client.o generated/Hello.o
> Client.o: Client.cc generated/Hello.h
>
>
> Pero al hacer make me daba lo siguiente:
>
> StringIntMap.cpp:16:26: error: StringIntMap.h: No existe el fichero ó
> directorio
>
> A parte de otras al menos 20 líneas de fallos.
>
> Solución, cambiar en el archivo StringIntMap.cpp los triangulitos <>
> del include <StringIntMap.h> por comillas "" "" . (recuerdo que eran
> diferentes pero no recuerdo la diferencia exacta, si alguien me puede
> sacar de la ignorancia se lo agradecería).
>
> Por lo que ahora al hacer el make todo va bien.
>
>
>
> He conseguido pasar el map este que te genera para poder utilizar la
> base de datos al constructor del sirviente:
>
> Freeze::ConnectionPtr connection =
> Freeze::createConnection(communicator(), "db");
> StringIntMap map(connection, "simple");
> map.clear();
>
>
> ObjectAdapterPtr oa =
> communicator()->createObjectAdapter("Vendedor");ObjectPrx prx =
> oa->add(new Vendedor(map),communicator()->stringToIdentity("Vende"));
> //En la instrucción anterior se lo pasamos al constructor
>
>
>
>
> Lo recivo en el constructor del sirviente:
>
>
> public : Vendedor(StringIntMap map){
>
> StringIntMap map_sirviente = map;
> Ice::Int i;
> StringIntMap::iterator p;
>
> // Poblar...
> for (i = 0; i < 26; i++) {
> std::string key(1, 'a' + i);
> map_sirviente.insert(make_pair(key, i));
> }
>
> }
>
>
> }
>
>
>
> Y le inserto lo anterior mediante el bucle for.
>
> Ahora bien, la pregunta es obligada:
>
> ¿Cómo puedo ver lo que he almacenado en la base de datos?
>
>
> Saludos y gracias.
>
> **********************************************************************************
> Cuando programo sólo tengo un problema, programar, cuando no programa
> tengo otros muchos problemas.
>
>
>
>
>
>
>
> On Nov 13, 2007 9:24 AM, FRANCISCO MOYA FERNANDEZ
> <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > StringIntMap.o lo tienes que añadir en todos los ejecutables que lo usen y
> > no puede ser el primer objeto (o tendrías que rehacer el makefile).
> >
> > En cuanto al error yo sigo apostando, a que ahora el error es diferente al
> > de antes.
> >
> >
> > > undefined reference to `StringIntMapValueCodec::typeId()
> >
> > Ese metodo está al final de StringIntMap.cpp
> >
> > Salud,
> > Paco
> >
> >
> > -----Mensaje original-----
> > De: [EMAIL PROTECTED] en nombre de Manuel David Jiménez
> > Patiño
> > Enviado el: lun 12/11/2007 22:43
> >
> > Para: [email protected]
> > Asunto: Re: [CRySoL] Freeze map
> >
> >
> >
> > > Apuesto a que no has añadido StringIntMap.o a los objetos de tu
> > ejecutable.
> >
> > Bueno ..., yo no apuesto nada, nunca me gustaron los juegos de azar
> > ...y más cuando sabes que vas a perder.
> >
> >
> > Efectivamente los objetos del ejecutable no los he tocado. Pero no sé
> > muy bien a qué te refieres, mi makefile va teniendo la siguiente
> > forma:
> >
> > CXXFLAGS=-Igenerated
> >
> > all: Server Server2 Client
> >
> >
> > Server: LDLIBS=-lIce -lFreeze
> > Server: Server.o generated/Hello.o
> > Server.o: Server.cc generated/Hello.h
> >
> > Server2: LDLIBS=-lIce -lFreeze
> > Server2: Server2.o StringIntMap.o generated/Hello.o
> > Server2.o: Server2.cc generated/Hello.h
> >
> > Client: LDLIBS=-lIce
> > Client: Client.o generated/Hello.o
> > Client.o: Client.cc generated/Hello.h
> >
> >
> > ...
> > ...
> > ...
> >
> > He probado a poner StringIntMap.o en diferentes posiciones del código
> > anterior pero me da fallo al hacer make.
> >
> >
> > Saludos.
> >
> >
> >
> >
> >
> > On Nov 12, 2007 9:40 PM, FRANCISCO MOYA FERNANDEZ
> > <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > >
> > > Apuesto a que no has añadido StringIntMap.o a los objetos de tu
> > ejecutable.
> > >
> > > Salud,
> > > Paco
> > >
> > > --
> > > Francisco Moya Fernandez Computer Architecture and Networks Group
> > > Assistant Professor
> > > [EMAIL PROTECTED] School of Computer Science
> > > Fax:(+34 926) 29 53 54 University of Castilla-La Mancha
> > > Tel:(+34 926) 29 54 83 http://www.inf-cr.uclm.es/
> > >
> > >
> > >
> > > -----Mensaje original-----
> > > De: [EMAIL PROTECTED] en nombre de Manuel David Jiménez
> > > Patiño
> > > Enviado el: lun 12/11/2007 21:27
> > > Para: [email protected]
> > > Asunto: [CRySoL] Freeze map
> > >
> > >
> > >
> > > Hola a todos aquí sigo sufriendo con Ice.
> > >
> > > Después de superar la etapa de IceGrid ahora tocaba utilizar freeze map.
> > >
> > > Os cuento como he intentado solucionar mi problema original
> > > intentándolo probar con un ejemplo sencillo:
> > >
> > > En un server tenía:
> > >
> > > struct Server: public Application {
> > > int run(int argc, char* argv[]) {
> > > shutdownOnInterrupt();
> > >
> > > Freeze::ConnectionPtr connection =
> > > Freeze::createConnection(communicator(), "db");
> > > ...
> > > ...
> > > ...
> > > ...
> > >
> > > communicator()->waitForShutdown();
> > > return 0;
> > > }
> > > };
> > >
> > >
> > > Y para poder utilizar freeze map utilizaba los siguientes pasos:
> > >
> > > añadir en el makefile la siguiente línea:
> > >
> > > LDLIBS= -lFreeze
> > >
> > > Ahora en línea de comandos poner:
> > >
> > > $ slice2freeze --dict StringIntMap,string,int StringIntMap
> > >
> > > Se crea un contenedor denominado StringIntMap con un tipo de
> > > clave string y un valor
> > > int. El último argumento hace referencia al nombre de los archivos de
> > > salida, que en este caso
> > > son StringIntMap.h y StringIntMap.cpp.
> > >
> > > Le doy a Intro y .... Bien! funciona.
> > >
> > > Ahora añado estas líneas al archivo server.cpp:
> > >
> > > #include <StringIntMap.h>
> > > #include <Freeze/Freeze.h>
> > >
> > >
> > > hago en línea de comandos:
> > >
> > > $make
> > >
> > > y bien funciona.
> > >
> > >
> > > EL PROBLEMA VIENE CUANDO EN SERVER.CPP añado la siguiente línea:
> > >
> > > struct Server: public Application {
> > > int run(int argc, char* argv[]) {
> > > shutdownOnInterrupt();
> > >
> > > Freeze::ConnectionPtr connection =
> > > Freeze::createConnection(communicator(), "db");
> > > StringIntMap map(connection, "simple"); <----- ESTA ES
> > LA
> > > QUE
> > > PROVOCA QUE MI PROGRAMA HAGA PUTUFF
> > >
> > >
> > >
> > >
> > > Ahora en línea de comandos pongo:
> > >
> > > $make
> > >
> > > y me saca el siguiente jeroglífico:
> > >
> > > In function `Freeze::Map<std::basic_string<char,
> > > std::char_traits<char>, std::allocator<char> >, int,
> > > StringIntMapKeyCodec, StringIntMapValueCodec,
> > > Freeze::IceEncodingCompare>::Map(IceInternal::Handle<Freeze::Connection>
> > > const&, std::basic_string<char, std::char_traits<char>,
> > > std::allocator<char> > const&, bool, Freeze::IceEncodingCompare
> > > const&)':
> > >
> > >
> > Server2.cc:(.text._ZN6Freeze3MapISsi20StringIntMapKeyCodec22StringIntMapValueCodecNS_18IceEncodingCompareEEC1ERKN11IceInternal6HandleINS_10ConnectionEEERKSsbRKS3_[Freeze::Map<std::basic_string<char,
> > > std::char_traits<char>, std::allocator<char> >, int,
> > > StringIntMapKeyCodec, StringIntMapValueCodec,
> > > Freeze::IceEncodingCompare>::Map(IceInternal::Handle<Freeze::Connection>
> > > const&, std::basic_string<char, std::char_traits<char>,
> > > std::allocator<char> > const&, bool, Freeze::IceEncodingCompare
> > > const&)]+0xb3): undefined reference to
> > > `StringIntMapValueCodec::typeId()'
> > >
> > >
> > Server2.cc:(.text._ZN6Freeze3MapISsi20StringIntMapKeyCodec22StringIntMapValueCodecNS_18IceEncodingCompareEEC1ERKN11IceInternal6HandleINS_10ConnectionEEERKSsbRKS3_[Freeze::Map<std::basic_string<char,
> > > std::char_traits<char>, std::allocator<char> >, int,
> > > StringIntMapKeyCodec, StringIntMapValueCodec,
> > > Freeze::IceEncodingCompare>::Map(IceInternal::Handle<Freeze::Connection>
> > > const&, std::basic_string<char, std::char_traits<char>,
> > > std::allocator<char> > const&, bool, Freeze::IceEncodingCompare
> > > const&)]+0xd6): undefined reference to
> > > `StringIntMapKeyCodec::typeId()'
> > > collect2: ld devolvió el estado de salida 1
> > > make: *** [Server2] Error 1
> > >
> > >
> > >
> > >
> > > ... Después de ver lo anterior. ¿Alguien me puede ayudar?
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Nota: también lo he probado así:
> > >
> > > struct Server: public Application {
> > > int run(int argc, char* argv[]) {
> > > shutdownOnInterrupt();
> > >
> > >
> > >
> > > ObjectAdapterPtr oa =
> > > communicator()->createObjectAdapter("Vendedor");
> > > ObjectPrx prx = oa->add(new
> > > Vendedor(),communicator()->stringToIdentity("Vende"));
> > >
> > > Freeze::ConnectionPtr connection =
> > > Freeze::createConnection(communicator(), "db");
> > > StringIntMap map(connection, "simple");
> > >
> > >
> > >
> > >
> > >
> > >
> > > Saludos.
> > >
> > >
> > > *****************************************************************
> > > La ciencia es algo más que un conjunto de técnicas, conocimientos,
> > > teoremas, pruebas ..., es una manera de pensar.
> > > Si a las asignaturas de Literatura en la ESI.
> > > _______________________________________________
> > > CRySoL mailing list
> > > http://crysol.inf-cr.uclm.es/
> > > https://arco.inf-cr.uclm.es/cgi-bin/mailman/listinfo/crysol
> > >
> > >
> > >
> > _______________________________________________
> > CRySoL mailing list
> > http://crysol.inf-cr.uclm.es/
> > https://arco.inf-cr.uclm.es/cgi-bin/mailman/listinfo/crysol
> >
> >
> >
> _______________________________________________
> CRySoL mailing list
> http://crysol.inf-cr.uclm.es/
> https://arco.inf-cr.uclm.es/cgi-bin/mailman/listinfo/crysol
_______________________________________________
CRySoL mailing list
http://crysol.inf-cr.uclm.es/
https://arco.inf-cr.uclm.es/cgi-bin/mailman/listinfo/crysol