title: compiling opencv in c++
body: <p>i have a file with only import:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  
  #include "cxcore.hpp"
  #include "highgui.hpp"
  
  using namespace cv;
  using namespace std;
  
  int main( int argc, char** argv )
  {
  
  }
  </code></pre>
  
  <p>and i try to compile with g++ -I/usr/include/opencv -lopencv -lm m.cpp</p>
  
  <p>but get whit error:</p>
  
  <blockquote>
    <p>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</p>
  </blockquote>
  
  <p>this is my copencv lib content:</p>
  
  <pre><code>alberto@zefiro:~$ 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
  </code></pre>
  
  <p>i'm on ubuntu 10.10</p>