[C con Clase] ayuda con conexion mysql

Dario Sbastian Sasturain sastuds en gmail.com
Mar Mayo 15 19:52:48 CEST 2007


bueno con respecto a los que decias del mysql - server y client
estan instalados y funcionando perfectamente ,soy Administrador de un par de
bases

mysql-common mysql-server-5.0 mysql-client-5.0

lo de find
ya lo habia probado pero solo me tira libmysqlclient.so

????????:/# find -name *mysqlclient*
./usr/lib/libmysqlclient.so.15.0.0
./usr/lib/libmysqlclient_r.so.15
./usr/lib/libmysqlclient_r.so.15.0.0
./usr/lib/libmysqlclient.so.15
./usr/share/doc/libmysqlclient15off
./root/Desktop/mysql++-2.2.3/libmysqlclient.def
./var/lib/dpkg/info/libmysqlclient15off.list
./var/lib/dpkg/info/libmysqlclient15off.postrm
./var/lib/dpkg/info/libmysqlclient15off.postinst
./var/lib/dpkg/info/libmysqlclient15off.md5sums
./var/lib/dpkg/info/libmysqlclient15off.shlibs

con lo que estaba marcado hice que cuando se configure  mysql ++ valla
a buscar alli las lib

MusiHack:~/Desktop/mysql++-2.2.3# ./configure --with-mysql=/usr/lib
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for ranlib... ranlib
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether make sets $(MAKE)... yes
checking for ar... ar
checking for strip... strip
checking for nm... nm
checking if make is GNU make... yes
checking for dependency tracking method... gcc
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ANSI C... (cached) none needed
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking zlib.h usability... no
checking zlib.h presence... no
checking for zlib.h... no
checking whether -lm is needed to use C math functions... no
checking whether -lsocket is needed... no
checking whether -lnsl is needed... no
checking for MySQL library directory... configure: error: Didn't find
mysqlclient library in '/usr/lib/lib/mysql /usr/lib/lib'


tambien probe asi

usiHack:~/Desktop/mysql++-2.2.3# ./configure --with-mysql=/usr
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for ranlib... ranlib
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether make sets $(MAKE)... yes
checking for ar... ar
checking for strip... strip
checking for nm... nm
checking if make is GNU make... yes
checking for dependency tracking method... gcc
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ANSI C... (cached) none needed
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking zlib.h usability... no
checking zlib.h presence... no
checking for zlib.h... no
checking whether -lm is needed to use C math functions... no
checking whether -lsocket is needed... no
checking whether -lnsl is needed... no
checking for MySQL library directory... configure: error: Didn't find
mysqlclient library in '/usr/lib/mysql /usr/lib'

y nada, realmente me parece raro que para hacer una simple conexion de
c o cc++ a mysql se complique asi :\

lo que realmente quiero es que cuando hago un program en c y llamo a
las libreria las encuentre
y mirando donde busca gcc las librerias es en
/usr/include/c++/4.1.2

obviamente no estan en esta carpeta las marcadas en rojo

#include "util.h"

#include <mysql++.h>

#include <iostream>
#include <iomanip>

using namespace std;

int
main(int argc, char *argv[])
{
    // Connect to the sample database.
    mysqlpp::Connection con(false);
    if (!connect_to_db(argc, argv, con)) {
        return 1;
    }

    // Retrieve a subset of the sample stock table set up by resetdb
    mysqlpp::Query query = con.query();
    query << "select item from stock";
    mysqlpp::Result res = query.store();

    // Display the result set
    cout << "We have:" << endl;
    if (res) {
        mysqlpp::Row row;
        mysqlpp::Row::size_type i;
        for (i = 0; row = res.at(i); ++i) {
            cout << '\t' << row.at(0) << endl;
        }
    }
    else {
        cerr << "Failed to get item list: " << query.error() << endl;
        return 1;
    }

    return 0;
}

este es el error al compilar

MusiHack:~# c++ conexion.cpp o conexion
c++: o: No existe el fichero o el directorio
c++: conexion: No existe el fichero o el directorio
conexion.cpp:1:18: error: util.h: No existe el fichero o el directorio
conexion.cpp:3:21: error: mysql++.h: No existe el fichero o el directorio
conexion.cpp: In function 'int main(int, char**)':
conexion.cpp:14: error: 'mysqlpp' has not been declared
conexion.cpp:14: error: expected `;' before 'con'
conexion.cpp:15: error: 'con' was not declared in this scope
conexion.cpp:15: error: 'connect_to_db' was not declared in this scope
conexion.cpp:20: error: 'mysqlpp' has not been declared
conexion.cpp:20: error: expected `;' before 'query'
conexion.cpp:21: error: 'query' was not declared in this scope
conexion.cpp:22: error: 'mysqlpp' has not been declared
conexion.cpp:22: error: expected `;' before 'res'
conexion.cpp:26: error: 'res' was not declared in this scope
conexion.cpp:27: error: 'mysqlpp' has not been declared
conexion.cpp:27: error: expected `;' before 'row'
conexion.cpp:28: error: 'mysqlpp' has not been declared
conexion.cpp:28: error: expected `;' before 'i'
conexion.cpp:29: error: 'i' was not declared in this scope
conexion.cpp:29: error: 'row' was not declared in this scope



por ende todas las funciones declaradaa en las cabeceras dan error

y pensaba en pegar las .h ahi en la carpeta pero es un arbol inmenso
asique que hago

¿ sigo probando instalr mysqll++
¿ estoy llendo bien

vale aclarar que ningun tuto de internet me soluciono el drama (sigo
buscando...)

gracias desde ya
sebastian





El día 14/05/07, Dario Sbastian Sasturain <sastuds en gmail.com> escribió:
>
> 1000 gracias poir la respuesta a la brevedad lo pruebo y te cuento amigo
> =)
>
> El día 10/05/07, Javier Sánchez < antydesk en ad-inet.org > escribió:
> >
> > Puedes buscar a ver si te encuentra este fichero... mmm mysqlclient.*
> >
> > slocate -u
> > slocate mysqlclient.*
> >
> > o
> >
> > find / -name mysqlclient.*
> >
> > puedes tambien mirar en el repositorio de debian porque puede que te
> > falte
> > la libreria.... no basta con el servidor de bases de datos y con el
> > cliente depende.... que yo recuerde en debian se instalaba:
> >
> > apt-get install mysql-server
> >
> > apt-get install mysql-client
> >
> > y supongo que luego tambien tendras losde las librerias y tal...
> >
> > apt-cache search mysql | less
> >
> > mira esas cosas y si no ya nos ponemos a ver lo que pasa realmente...
> > saludos tio ;)
> >
> >
> >
> > Dario Sbastian Sasturain escribió:
> > > ---------- Forwarded message ----------
> > > From: Dario Sbastian Sasturain < sastuds en gmail.com>
> > > Date: 06-may-2007 13:34
> > > Subject: ayuda con conexion mysql
> > > To: c-con-clase en smartgroups.com
> > >
> > > buenas gente de la lista hace rato estoy inscripto esperando el
> > momento
> > > para
> > > empesar ,
> > > mi proble es el siguiente quiero hacer algo tan facil como una
> > conecion
> > > desde codigo c++ a mysql que esta perfectamente  instalado , creo
> > seria
> > > bueno aclarar que uno Linux Debian 4.0 y que el directorio de mysql
> > 5.0 es
> > > el siguiente
> > > MusiHack:/# whereis mysql
> > > mysql: /usr/bin/mysql /etc/mysql /usr/X11R6/bin/mysql
> > /usr/bin/X11/mysql
> > > /usr/share/mysql /usr/share/man/man1/mysql.1.gz
> > > estos son los directorios de instalacion
> > > uso gcc
> > > MusiHack:/# whereis gcc
> > > gcc: /usr/bin/gcc /usr/lib/gcc /usr/X11R6/bin/gcc /usr/bin/X11/gcc
> > > esos son sus directorios
> > >
> > > la cuestios es que despues de andar con el dr, google entiendo que
> > tengo
> > > que
> > > tener la libreria mysql++ (si no es asi por favor corrijanme)
> > > bajo mysql++2.2.3 cuando le doy ./configure me sale lo siguiente
> > >
> > > checking for MySQL library directory... configure: error: Didn't find
> > > mysqlclient library in '/usr/lib64 /usr/lib /usr/lib64/mysql
> > > /usr/lib/mysql
> > > /usr/local/lib64 /usr/local/lib /usr/local/lib/mysql
> > /usr/local/mysql/lib
> > > /usr/local/mysql/lib/mysql /opt/mysql/lib /opt/mysql/lib/mysql'
> > >
> > > tambien he probado definiendo el directorio de mysql
> > >
> > > --with-mysql=/usr/local/mysql
> > >
> > > pero sigue sin encontrar segun el error el mysqlclient
> > >
> > > alguien podria darme una mano , talver un apt-get que me deje el gcc a
> > > tiro
> > > para empesar
> > > _______________________________________________
> > > Lista de correo Cconclase Cconclase en listas.conclase.net
> > > http://listas.conclase.net/mailman/listinfo/cconclase_listas.conclase.net
> >
> > > Bajas: http://listas.conclase.net/index.php?gid=2&mnu=FAQ
> >
> >
> > Un saludo, Javier Sánchez (AntyDesk)
> > ------------------------------------
> > Web: http://www.ad-inet.org
> > Email personal: antydesk en ad-inet.org
> > Email trabajo: info en ad-inet.org
> > ------------------------------------
> > "Realmente, no estoy tratando de destruir a Microsoft. Ese será tan solo
> >
> > un efecto colateral no intencionado."
> > Linus Torvalds (2003)
> >
> > Hay 10 tipos de personas en este mundo, las que saben de binario y las
> > que
> > no.
> >
> > En que grupo estas tu?
> >
> > ------------------------------------
> > Linux Users nº 445830.
> >
> >
> >
> >
> > _______________________________________________
> > Lista de correo Cconclase Cconclase en listas.conclase.net
> >
> > http://listas.conclase.net/mailman/listinfo/cconclase_listas.conclase.net
> > Bajas: http://listas.conclase.net/index.php?gid=2&mnu=FAQ
> >
>
>
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://listas.conclase.net/pipermail/cconclase_listas.conclase.net/attachments/20070515/c0f3cdfb/attachment.html>


Más información sobre la lista de distribución Cconclase