SoloCodigo

Programación General => C/C++ => Mensaje iniciado por: roleiland en Lunes 20 de Junio de 2011, 14:59

Título: Ejemplo Makefile Opencv2.2
Publicado por: roleiland en Lunes 20 de Junio de 2011, 14:59
Hola estoy intentando crear un Makefile para compilar un programilla de ejemplo de Opencv de la siguiente manera:

#compiler
C++ = g++

#flags
CFLAGS = -Wall -DASSERT -g

OPENCV_DIR = $(HOME)/local/lib/opencv2.2/opencv

IFLAGS = -I$(OPENCV_DIR)/include/opencv

LFLAGS = -L$(OPENCV_DIR)/release/lib

OPTIONS = -lcxcore -lcv -lhighgui -lcvaux -lml

#targets of the makefile
TARGETS = prueba

#no quiero usar esto
#CFLAGS += `pkg-config opencv --cflags`
#LFLAG += `pkg-config opencv --libs`

####################
#Targets           #
####################

all: $(TARGETS)

prueba.o:
   $(C++) -c prueba.cpp $(CFLAGS) $(IFLAGS) $(LFLAGS) $(OPTIONS)

prueba: prueba.o
   $(C++) -o prueba prueba.o $(OPTIONS)
   
clean:
   rm prueba *.o *~ -f

Cuando ejecuto "make" obtengo la siguiente salida:

make
g++ -c prueba.cpp -Wall -DASSERT -g -I/home/dani/local/lib/opencv2.2/opencv/include/opencv -L/home/dani/local/lib/opencv2.2/opencv/release/lib -lcxcore -lcv -lhighgui -lcvaux -lml
In file included from prueba.cpp:2:
/home/dani/local/lib/opencv2.2/opencv/include/opencv/highgui.h:45:33: error: opencv2/core/core_c.h: No such file or directory
/home/dani/local/lib/opencv2.2/opencv/include/opencv/highgui.h:46:33: error: opencv2/core/core.hpp: No such file or directory
/home/dani/local/lib/opencv2.2/opencv/include/opencv/highgui.h:47:39: error: opencv2/highgui/highgui_c.h: No such file or directory
/home/dani/local/lib/opencv2.2/opencv/include/opencv/highgui.h:48:39: error: opencv2/highgui/highgui.hpp: No such file or directory
prueba.cpp: In function ‘int main(int, char**)’:
prueba.cpp:7: error: ‘IplImage’ was not declared in this scope
prueba.cpp:7: error: ‘img’ was not declared in this scope
prueba.cpp:7: error: ‘CV_LOAD_IMAGE_UNCHANGED’ was not declared in this scope
prueba.cpp:7: error: ‘cvLoadImage’ was not declared in this scope
prueba.cpp:9: error: ‘CV_WINDOW_AUTOSIZE’ was not declared in this scope
prueba.cpp:9: error: ‘cvNamedWindow’ was not declared in this scope
prueba.cpp:11: error: ‘cvShowImage’ was not declared in this scope
prueba.cpp:13: error: ‘cvWaitKey’ was not declared in this scope
prueba.cpp:15: error: ‘cvReleaseImage’ was not declared in this scope
prueba.cpp:16: error: ‘cvDestroyWindow’ was not declared in this scope
make: *** [prueba.o] Error 1

Os paso el código: "mediafire.com/?cbwrfc0xk2q7xii"

Gracias.
Título: Re: Ejemplo Makefile Opencv2.2
Publicado por: roleiland en Martes 21 de Junio de 2011, 10:33
Ya he conseguido compilar mediante el Makefile utilizando solo las bibliotecas instaladas en mi HOME. Si me permitis publicar links os subo el código.
Título: Re: Ejemplo Makefile Opencv2.2
Publicado por: ProfesorX en Martes 21 de Junio de 2011, 15:18
Cita de: "roleiland"
Si me permitis publicar links os subo el código.

El foro bloquea la publicacion de links a los nuevos, para evitar a aquellos que solo publican SPAM.

Despues de que tengas publicados 20 mensajes en el foro, se desbloquea automaticamente la publicacion de links, mientras no se puede hacer mas, asi que te toca esperar.

Saludos :)
Título: Re: Ejemplo Makefile Opencv2.2
Publicado por: roleiland en Miércoles 22 de Junio de 2011, 11:14
Era por aportar un poco a la comunidad, ya que a mi hacer esta tarea me ha llevado su tiempo... Bueno en cualquier caso, subo el link aunque quede mal:

(añadir World Wide Web).mediafire.com/?kea5on9wdbc3ynh