Foros del Web » Programación para mayores de 30 ;) » C/C++ »

undefined reference to....

Estas en el tema de undefined reference to.... en el foro de C/C++ en Foros del Web. Hi! i am trying to compile/link a simple application that uses a library called OpenDBX. I have already compiled and installed that library. Now, i ...
  #1 (permalink)  
Antiguo 13/01/2008, 18:29
 
Fecha de Ingreso: enero-2008
Mensajes: 1
Antigüedad: 16 años, 3 meses
Puntos: 0
undefined reference to....

Hi! i am trying to compile/link a simple application that uses a library called OpenDBX. I have already compiled and installed that library. Now, i am trying to do a simple client of it.

The client (Prueba.c) is just like this:
Código:
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <odbx.h>

int main(void) {
	puts("Hello World!!");
	
		int err;
		odbx_t* handle;
	
		if( ( err = odbx_init( &handle, "mysql", "127.0.0.1", "" ) ) < 0 )
		{
		    fprintf( stderr, "odbx_init(): %s\n", odbx_error( handle, err ) );
		    return err;
		}
		
		return EXIT_SUCCESS;
}


When i try to compile that program (Prueba.c), i has this error:

cc -c -o Prueba.o Prueba.c
gcc -O2 -g -Wall -fmessage-length=0 -L/usr/local/lib -L/usr/local/lib/opendbx -L/usr/local/lib/pkgconfig -o Pruebas Prueba.o
Prueba.o: In function `main':
Prueba.c:(.text+0x3c): undefined reference to `odbx_init'
Prueba.c:(.text+0x57): undefined reference to `odbx_error'
collect2: ld returned 1 exit status
make: *** [Pruebas] Error 1


Those functions (odbx_error and odbx_init are both defined in odbx.h (the header of openDBX y need to include).

I have checked that openDBX libraries are okey. There are in /usr/local/lib , /usr/local/lib/opendbx and /usr/local/lib/pkgconfig.

My makefile is like this:

Código:
COMPILER = gcc

CCFLAGS =	-O2 -g -Wall -fmessage-length=0 

OBJS =		Prueba.o

LIBS = 

TARGET =	Pruebas

LDFLAGS = -L/usr/local/lib -L/usr/local/lib/opendbx -L/usr/local/lib/pkgconfig

$(TARGET):	$(OBJS)
	${COMPILER} ${CCFLAGS} $(LDFLAGS) -o $(TARGET) $(OBJS) $(LIBS)

all:	$(TARGET)

clean:
	rm -f $(OBJS) $(TARGET)
So...can someone please tell what does this error mean ? i think that it doesn't found the library asosiated with de odbx.h, but i am not sure.

Very thanks

Mariano
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 17:21.