Ask Your Question
0

OpenCV and Cygwin - can't compile tutorials

asked 2013-05-27 07:48:13 -0600

Vercinger gravatar image

updated 2013-05-27 09:18:33 -0600

I followed this guide to (try) install OpenCV on my cygwin since that's the only environment I've worked with and there wasn't anyone like it on the OpenCV homepage.

I'm not sure if that's a valid install because when I try to compile some of the core tutorials like mat_the_basic_image_container I get this error:

Ejvind E. Lauritsen@EjvindELauritse/cygdrive/c/opencv/samples/cpp/
tutorial_code/core/mat_the_basic_image_container
$ gcc mat_the_basic_image_container.cpp
mat_the_basic_image_container.cpp: In function ‘int main(int, char**)’:
mat_the_basic_image_container.cpp:62:51: error: ‘FMT_PYTHON’ is not a member of ‘cv::Formatter’
mat_the_basic_image_container.cpp:63:51: error: ‘FMT_NUMPY’ is not a member of ‘cv::Formatter’
mat_the_basic_image_container.cpp:64:51: error: ‘FMT_CSV’ is not a member of ‘cv::Formatter’
mat_the_basic_image_container.cpp:65:51: error: ‘FMT_C’ is not a member of ‘cv::Formatter’

Why is OpenCV so hard to install? I just want it to work so I can code in a simple editor and then compile it with cygwin..

I'm so desperate! Heeelp! How does anyone get OpenCV to work, ever?

Edit After commenting out the error lines I get this:

Ejvind E. Lauritsen@EjvindELauritse/cygdrive/c/opencv/samples/cpp/tutorial_code/core/mat_the_basic_image_container
$ gcc mat_the_basic_image_container.cpp
collect2: ld afsluttet af signal 11 [Segmentation fault], core dumped /tmp/ccfA3Vvh.o:mat_the_basic_image_container.cpp:(.text+0xe): undefined reference to    `cv::Formatter::get(char const*)
/tmp/ccfA3Vvh.o:mat_the_basic_image_container.cpp:(.text+0x52): undefined reference to `std::cout'/tmp/ccfA3Vvh.o:mat_the_basic_image_container.cpp:(.text+0x57): undefined reference to `std::basic_ostream<char,std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >& 
... plus a ton more
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2013-05-27 08:14:48 -0600

berak gravatar image

which opencv version are you using ?

( as of 2.4.2, there's a Formatter class in core.hpp, which defines those constants, but the compiler finds another class with the same name in operations.hpp first, which does not. same error as you get )

( as of 2.4.9, it just works )

if you're using 2.4.5, chances are high, that someone overeagerly updated the tutorial to the trunk version

just comment out lines 62-65.

edit flag offensive delete link more

Comments

2.4.5.. Downloaded from here: http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.5/

I thought the tutorials were done so you could just compile it without errors.. I'm really confused as how anyone ever gets openCV to work..

Vercinger gravatar imageVercinger ( 2013-05-27 08:58:14 -0600 )edit

note, that now your getting linker errors. so it actually compiled !

did you try to use g++ instead of gcc ? (as it's c++!) also, if you commented out those lines you should not get anything Formatter-realated anymore. clean up your previous .o files !

berak gravatar imageberak ( 2013-05-27 09:42:24 -0600 )edit

When you say "clean up your previous .o files" what do you mean? I'm not that experienced in C++ and I don't have any .o files..

When using g++ instead I get a lot more 'undefined references'.

$ g++ mat_the_basic_image_container.cpp collect2: ld afsluttet af signal 11 [Segmentation fault], core dumped /tmp/ccwkZvFZ.o:mat_the_basic_image_container.cpp:(.text+0xe): undefined reference to cv::Formatter::get(char const*)' /tmp/ccwkZvFZ.o:mat_the_basic_image_container.cpp:(.text+0x341): undefined reference tocv::Mat::eye(int, int, int)' ...

Vercinger gravatar imageVercinger ( 2013-05-27 09:57:22 -0600 )edit

do you link against openvc_core245.a ? sounds not so.

berak gravatar imageberak ( 2013-05-27 10:02:35 -0600 )edit

I've used the guide (linked in first post) to install OpenCV to work with cygwin.

Then I've tried compiling the tutorial, nothing else, to test it.. That's the only thing I have.. I have not linked against what you said, and I honestly don't know how to do that.

Vercinger gravatar imageVercinger ( 2013-05-27 10:10:16 -0600 )edit

Question Tools

Stats

Asked: 2013-05-27 07:48:13 -0600

Seen: 2,944 times

Last updated: May 27 '13