Tengo un archivo con sólo importan:compilar OpenCV en C++
#include <iostream>
#include <stdio.h>
#include "cxcore.hpp"
#include "highgui.hpp"
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
}
y trato de compilar con g ++ -I/usr/include/OpenCV -lopencv -lm m.cpp
pero llegar whit de error:
In file included from /usr/include/opencv/cxcore.hpp:46, from m.cpp:5: /usr/include/opencv/cxmisc.h:214: error: expected constructor, destructor, or type conversion before ‘void’ /usr/include/opencv/cxmisc.h:220: error: expected constructor, destructor, or type conversion before ‘int’ /usr/include/opencv/cxmisc.h:226: error: ‘CV_INLINE’ does not name a type /usr/include/opencv/cxmisc.h:516: error: ‘CV_DEPTH_MAX’ was not declared in this scope /usr/include/opencv/cxmisc.h:522: error: ‘CV_DEPTH_MAX’ was not declared in this scope /usr/include/opencv/cxmisc.h:522: error: ‘CV_CN_MAX’ was not declared in this scope In file included from m.cpp:5: /usr/include/opencv/cxcore.hpp:70: error: template declaration of ‘cv::CV_EXPORTS cv::Size_’ /usr/include/opencv/cxcore.hpp:71: error: template declaration of ‘cv::CV_EXPORTS cv::Point_’ /usr/include/opencv/cxcore.hpp:72: error: template declaration of ‘cv::CV_EXPORTS cv::Rect_’ /usr/include/opencv/cxcore.hpp:77: error: expected initializer before ‘fromUtf16’ /usr/include/opencv/cxcore.hpp:78: error: expected initializer before ‘toUtf16’ /usr/include/opencv/cxcore.hpp:80: error: expected initializer before ‘format’ /usr/include/opencv/cxcore.hpp:82: error: expected initializer before ‘:’ token m.cpp:38: error: expected ‘}’ at end of input
esta es mi copencv contenido lib:
[email protected]:~$ ls /usr/include/opencv/
cvaux.h cvcompat.h cv.hpp cvtypes.h cvvidsurv.hpp cxcore.h cxerror.h cxmat.hpp cxoperations.hpp highgui.h ml.h
cvaux.hpp cv.h cvinternal.h cvver.h cvwimage.h cxcore.hpp cxflann.h cxmisc.h cxtypes.h highgui.hpp
estoy en ubuntu 10.10
suspiro. esto compila pero me conserva en este problema http://stackoverflow.com/q/9088228/433685 – nkint
(problema que pensé resolver para cambiar el encabezado ...) – nkint
Siempre olvido el nombre de la utilidad pkg-config. Gracias por la simple solución! – aaronsnoswell