Profactor / cv-plot

fast modular opencv plotting library
MIT License
159 stars 30 forks source link

Compile Error with opencv-3.4.6 #35

Closed TPIOS closed 2 years ago

TPIOS commented 2 years ago

Hi,

When I download the recent version of CvPlot, I include the header file in my code like this, `#define CVPLOT_HEADER_ONLY

include <CvPlot/cvplot.h>`

There is nothing in the main code yet. But when I compile the code, it gives me error like Error C2664 'CvPlot::LineBaseSub::LineBaseSub(const CvPlot::LineBaseSub &)' : cannot convert argument 1 from 'const std::string' to 'const CvPlot::LineBaseSub &' CvPlot\inc\CvPlot\imp\Series.ipp

which is here

CVPLOT_DEFINE_FUN Series::Series(cv::InputArray data, const std::string &lineSpec) : LineBaseSub(lineSpec) , impl(*this) { cv::Mat d = data.getMat(); if (impl->xyValid(data)){ setY(data); }else if(impl->pointsValid(data)){ setPoints(data); }else { throw std::invalid_argument("invalid data in Series constructor. See Series.h for supported types"); } setLineSpec(lineSpec); }

Any ideas about this issue? I am using VS2013+opencv3.4.6 with opencv_contrib

TPIOS commented 2 years ago

If I comment like this, it would pass the compilation. But which kind of functions may I lose? LineBaseSub()//LineBaseSub(lineSpec)

wpalfi commented 2 years ago

Hi @TPIOS, cvplot requires C++11. It seems that VS2013 does not support Inheriting Constructors. The problem is this line: https://github.com/Profactor/cv-plot/blob/c21465bcefcea80a03d8b36d76ef020d7c77bedd/CvPlot/inc/CvPlot/drawables/LineBase.h#L37

You may work around by implementing the missing constructor in LineBase.h