#1 Le 19/06/2015, à 12:18
- chfakht
Compiler un fichier avec opencv 3.0.0 sous ubuntu 14.04
Bonjour tous le mon apres l'installation d'opencv j'ai voulu faire un test avec ce fichier :
#include<stdio.h>
#include<stdlib.h>
#include<opencv/highgui.h>
int main (int argc, char* argv[])
{
IplImage* img = NULL;
const char* window_title = "Hello, OpenCV!";
if (argc < 2)
{
fprintf (stderr, "usage: %s IMAGE\n", argv[0]);
return EXIT_FAILURE;
}
img = cvLoadImage(argv[1], CV_LOAD_IMAGE_UNCHANGED);
if (img == NULL)
{
fprintf (stderr, "couldn't open image file: %s\n", argv[1]);
return EXIT_FAILURE;
}
cvNamedWindow (window_title, CV_WINDOW_AUTOSIZE);
cvShowImage (window_title, img);
cvWaitKey(0);
cvDestroyAllWindows();
cvReleaseImage(&img);
}
return EXIT_SUCCESS;
par la suite :
# compilation
gcc -c helloworld.c -Wall `pkg-config opencv --cflags`
# édition des liens
gcc helloworld.o -o helloworld `pkg-config opencv --libs`
pour que ca fonctionne bien je doit mettre le fichier a compiler dans le sossier ou se trouve opencv a savoir : usr/local/lib
mais dans d'autre dossier ca ne marche pas .... ya t'il une solution pour que je puisse compiler le fichier dans n'importe quelle dossier ??
MERCI
Dernière modification par chfakht (Le 19/06/2015, à 12:26)
Hors ligne
#2 Le 19/06/2015, à 13:33
- credenhill
Re : Compiler un fichier avec opencv 3.0.0 sous ubuntu 14.04
hello
essayer l'édition de lien avec l'option : -L /usr/local/lib
Hors ligne