renatoGarcia/opencv-swig

Error: Unable to find 'opencv2/core/version.hpp'

TailyDuan opened this issue · 6 comments

I run swig -I/home/ubuntu64/swig_libs -c++ -python my_lib.i, but show these error, why?

swig -I/home/ubuntu64/swig_libs -c++ -python my_lib.i

/home/ubuntu64/swig_libs/opencv/detail/range.i:12: Error: Unable to find 'opencv2/core/version.hpp'
/home/ubuntu64/swig_libs/opencv/detail/common.i:55: Error: Unable to find 'opencv2/core/version.hpp'
/home/ubuntu64/swig_libs/opencv/detail/matx.i:12: Error: Unable to find 'opencv2/core/version.hpp'
/home/ubuntu64/swig_libs/opencv/detail/vec.i:12: Error: Unable to find 'opencv2/core/version.hpp'
/home/ubuntu64/swig_libs/opencv/detail/point.i:12: Error: Unable to find 'opencv2/core/version.hpp'

I met the same question. Do you have any solution? I ran it in the windows @TailyDuan

添加 opencv的路径

swig -I/home/mory/projects/opencv-swig/lib -c++ `pkg-config --cflags opencv` -python interface.i 

添加 opencv的路径

swig -I/home/mory/projects/opencv-swig/lib -c++ `pkg-config --cflags opencv` -python interface.i 

I am getting the same error even if I use the same command suggested by you.

swig -c++ -python -Iopencv-swig/lib/ pkg-config --cflags opencv file.i

Try

`pkg-config --cflags opencv`

instead of

pkg-config --cflags opencv

@siriusdemon Yes I did that only. I found the solution that we need to specify the path for opencv2 i.e. /usr/include (in case of linux).

swig -c++ -python -Iopencv-swig/lib -I/usr/include `pkg-config --cflags opencv` file.i

@TailyDuan, has this solution worked for you?