Declare it static in the class declaration, not at the function definition.

Esteban Zeller wrote:
El Sábado 20 Mayo 2006 21:40, Brannon King escribió:
Is it declared as a static function? Something like "static int
bd::analisis_ultimo(void* arg)" ? I assume it would need to be static
just like all the other thread function parameters or callback
parameters in various APIs.

Esteban Zeller wrote:
I'v got the next problem:

string cola = "SELECT * FROM ultimo;";
 char zErrMsg;
 int ret = sqlite3_exec( base_datos, cola.c_str(), (bd::analisis_ultimo),
0, &zErrMsg );
 ....

the compiler tell me this:

/home/Programas/preguntas/src/bd.cpp:151: error: no matches converting
function `analisis_ultimo' to type `int (*)(void*, int, char**, char**)'

the functions uses the same prototipe of the example but it's inside of a
class

If I get it declared static the compiler say the next:

/home/Programas/preguntas/src/bd.cpp: At global scope:
/home/Programas/preguntas/src/bd.cpp:168: error: cannot declare member function `static int bd::analisis_ultimo(void*, int, char**, char**)' to have static linkage

here is part of the code:


ultima_entrada *  bd::cargar_ultimo_uso()
{
 string cola = "SELECT * FROM ultimo;";
 char *zErrMsg;
int ret = sqlite3_exec( base_datos, cola.c_str(), (bd::analisis_ultimo), 0, &zErrMsg );
 if( ret != SQLITE_OK )
 {
  cout<<"Error al ejecutar la consulta SQL:"<<cola<<endl;
  cout<<"Numero de error:"<<ret<<endl;
  cout<<"Descripcion del error:"<<zErrMsg<<endl;
 }
 else
 {
  return( ultima );
 }
}

static int bd::analisis_ultimo( void *NotUsed, int argc, char **argv, char **azColName )
{
  int i;
  for(i=0; i<argc; i++){
    printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
  }
  printf("\n");
  return 0;
}

        
        
                
___________________________________________________________ 1GB gratis, Antivirus y Antispam Correo Yahoo!, el mejor correo web del mundo http://correo.yahoo.com.ar


Reply via email to