xingdi-eric-yuan / named-entity-recognition

A simple NER model in C++
39 stars 45 forks source link

problem with persistence.hpp during make #3

Open antalexa opened 8 years ago

antalexa commented 8 years ago

I had an issue during make. here is the error "/usr/local/include/opencv2/core/persistence.hpp:793:17: error: no matching function for call to 'read' read(**it, vec[i], _Tp());"

.....

"1 error generated. make[2]: * [CMakeFiles/NER.dir/src/weights_IO.cc.o] Error 1 make[1]: * [CMakeFiles/NER.dir/all] Error 2 make: *\ [all] Error 2"

did anyone else have a similar issue or know what is going on?

kostasl commented 8 years ago

Hi antalexa, I have the same problem when using qt5 with opencv3 compiled with WITH_QT=ON. I am trying to figure out what the conflict is.

kostasl commented 8 years ago

Ok, indeed with opencv ver 3. the file persistence.hpp does not include a version of function for some parameter types. through a some operator >> call you end up calling read( const FileNode& node, std::vector<_Tp>& vec, const std::vector<_Tp>& default_value = std::vector<_Tp>() )

In my case I get :

usr/local/include/opencv2/core/persistence.hpp:1107:27:   required from 'cv::FileNodeIterator& cv::operator>>(cv::FileNodeIterator&, std::vector<_RealType>&) [with _Tp = std::basic_string<char>]'
/usr/local/include/opencv2/core/persistence.hpp:1130:8:   required from 'void cv::operator>>(const cv::FileNode&, std::vector<_RealType>&) [with _Tp = std::basic_string<char>]'
../Control/InputGenerator.cpp:62:27:   required from here
/usr/local/include/opencv2/core/persistence.hpp:793:41: error: no matching function for call to 'read(cv::FileNode, __gnu_cxx::__alloc_traits<std::allocator<std::basic_string<char> > >::value_type&, std::basic_string<char>)'
                 read(**it, vec[i], _Tp());

thus call it with  _Tp being std:string,  then a required version of a read function such
static inline
void read(const FileNode& node, uchar& value, uchar default_value)

exists for a few types like uchar above, but not for std:string.

Yet if you look in opencv 2.4.12 this function existed in core/operations.hpp and it had an std:string overload.

Thus I believe there is a bug, where an overload of read() function for std:string has been missed.