renatoGarcia/opencv-swig

I can't to compile it correctly

Closed this issue · 5 comments

I use python2 and cmake 2.8.

  1. enter test
  2. do 'cmake .'
  3. do 'make'
  4. lost of error happen.

for example:
'''
In file included from /usr/local/include/opencv2/core.hpp:60:0,
from my_lib_wrap.cxx:3309:
/usr/local/include/opencv2/core/persistence.hpp:741:25: note: cv::FileStorage& cv::operator<<(cv::FileStorage&, const cv::String&)
CV_EXPORTS FileStorage& operator << (FileStorage& fs, const String& str);
^
/usr/local/include/opencv2/core/persistence.hpp:741:25: note: no known conversion for argument 1 from ‘std::ostream {aka std::basic_ostream}’ to ‘cv::FileStorage&’
/usr/local/include/opencv2/core/persistence.hpp:1059:14: note: template cv::FileStorage& cv::operator<<(cv::FileStorage&, const _Tp&)
FileStorage& operator << (FileStorage& fs, const _Tp& value)
^
/usr/local/include/opencv2/core/persistence.hpp:1059:14: note: template argument deduction/substitution failed:
In file included from /usr/local/include/opencv2/core.hpp:3163:0,
from my_lib_wrap.cxx:3309:
/usr/local/include/opencv2/core/operations.hpp:3994:12: note: cannot convert ‘out’ (type ‘std::ostream {aka std::basic_ostream}’) to type ‘cv::FileStorage&’
out << "[" << p.x << ", " << p.y << "]";
'''

Do you have any idea for me ? Thank you .

It sounds like the std::ostream& operator<<(std::ostream&, <opencv type>) functions aren't being found. If that is the problem, you can solve it by putting an #include <file.hpp> inside a %header section of your SWIG project file, where <file.hpp> is the OpenCV source file defining that functions.
What is the SWIG and OpenCV versions you are using? Could you share a minimal project that raise that error?

Hi , Thank you for your feedback.
I just build your sample in test folder. it is lots of errors appear.
Anyway , I also coding following your README.md , the same error again.
My SWIG is 2.0.11 and OpenCV is 2.4.11. (By the way , python2 and cmake 2.8 in Ubuntu14.04)

@BobLiu20 I have added support to OpenCV 2.4.11 and Python 2. Could you please run the tests again? The only difference between ours systems is that I'm using SWIG version 3.

thank you guy . it seems ok .