|
From: | Cacahuete Frito |
Subject: | Fwd: opencv3 incompatibility |
Date: | Wed, 17 Apr 2019 13:50:37 +0200 |
Hi,Attached here, you have the output of the preprocessor
$(Q)$(CXX) $(CXXFLAGS) -I $(INC_DIR) -E $< -o main.iI also filed a bug in openCV yesterday because I didn't know if it was a ncurses bug or opencv bug (or maybe both):Maybe COLS and LINES weren't the best names for macros (as in <ncurses.h>), and also for a const int (as in <opencv2/core/utility.hpp>); too common.Thank you.El mar., 16 abr. 2019 a las 22:53, Thomas Dickey (<address@hidden>) escribió:On Tue, Apr 16, 2019 at 04:41:32PM +0200, Cacahuete Frito wrote:
> System information (version)
>
> - ncurses => 6 (ncurses-devel)
> - OpenCV => 3.4 (opencv-devel)
> - Operating System / Platform => openSUSE Tumbleweed
> - Compiler => g++ 8 (gcc8-c++)
>
> Detailed description
>
> Incompatibility with opencv & ncurses.
It might help if you produced/sent the output of the preprocessor,
to show what's being mis-translated.
However - I pulled a temporary copy of opencv, to answer this.
The usual problem versus C++ is methods named "clear", etc.
opencv does that, but this is a little different.
> I was using opencv2 on Debian, and today I moved to openSUSE Tumbleweed,
> which has opencv3, and my first make failed with this error (see attached
> file).
> Steps to reproduce
>
> If ncurses.h is included before opencv headers, build breaks.
> Workaround: #include <opencv2/opencv.hpp> before #include <ncurses.h>
>
> CXX vision-artificial/tmp/main.s
> In file included from /usr/include/ncurses/ncurses.h:60,
> from /home/user/Desktop/code_c/vision-artificial/libalx//inc/libalx/extra/ncurses/common.hpp:21,
> from /home/user/Desktop/code_c/vision-artificial/src//main.cpp:16:
> /usr/include/opencv2/core/utility.hpp: In member function ‘void cv::Mat::forEach_impl(const Functor&)’:
> /usr/include/ncurses/ncurses.h:1469:46: error: declaration of ‘const int cv::_nc_LINES()’ has ‘extern’ and is initialized [-Werror]
> #define LINES NCURSES_PUBLIC_VAR(LINES())
> ^
ncurses defines LINES. In the "normal" model, that would be an external
symbol...
> In file included from /usr/include/opencv2/core.hpp:3280,
> from /usr/include/opencv2/core/core.hpp:48,
> from /home/user/Desktop/code_c/vision-artificial/inc/vision-artificial/image/iface.hpp:21,
> from /home/user/Desktop/code_c/vision-artificial/src//main.cpp:19:
> /usr/include/opencv2/core/utility.hpp:592:34: error: invalid pure specifier (only ‘= 0’ is allowed) before ‘<’ token
> const int LINES = static_cast<int>(this->total() / this->size[this->dims - 1]);
which should produce a compiler/linker error on this line.
It's _not_ const in any curses implementation.
However, SuSE configures the "thread" model, which makes ncurses
use #define for LINES.
Either way, I don't see how to improve things other than by fixing opencv.
Same comment here:
^
> In file included from /usr/include/ncurses/ncurses.h:60,
> from /home/user/Desktop/code_c/vision-artificial/libalx//inc/libalx/extra/ncurses/common.hpp:21,
> from /home/user/Desktop/code_c/vision-artificial/src//main.cpp:16:
> /usr/include/opencv2/core/utility.hpp: In member function ‘virtual void cv::Mat::forEach_impl(const Functor&)::PixelOperationWrapper::operator()(const cv::Range&) const’:
> /usr/include/ncurses/ncurses.h:1467:45: error: declaration of ‘const int cv::_nc_COLS()’ has ‘extern’ and is initialized [-Werror]
> #define COLS NCURSES_PUBLIC_VAR(COLS())
> ^
> In file included from /usr/include/opencv2/core.hpp:3280,
> from /usr/include/opencv2/core/core.hpp:48,
> from /home/user/Desktop/code_c/vision-artificial/inc/vision-artificial/image/iface.hpp:21,
> from /home/user/Desktop/code_c/vision-artificial/src//main.cpp:19:
> /usr/include/opencv2/core/utility.hpp:605:33: error: invalid pure specifier (only ‘= 0’ is allowed) before ‘->’ token
> const int COLS = mat->size[DIMS - 1];
> ^~
> cc1plus: all warnings being treated as errors
:-)
--
Thomas E. Dickey <address@hidden>
https://invisible-island.net
ftp://ftp.invisible-island.net
main_correct.i
Description: Binary data
[Prev in Thread] | Current Thread | [Next in Thread] |