tesseract Remove_Reference ambiguous symbol in project on visual studio 2012

人盡茶涼 提交于 2019-12-12 11:34:27

问题


I will describe my situation more in detail. I am building a system for the recognition of license plates, using C + + ,OpenCV ,Tesserect , but when I compile the code it is returned to me a stack of errors ambiguous references, so I inspected all lines of my code . I searched this group for solutions and have tried several without success.

Problems:

error C2872 : ' Remove_Reference ' : ambiguous symbol File: tesscallback.h Line : 1011
error C2872 : ' Remove_Reference ' : ambiguous symbol File: tesscallback.h Line : 1030
error C2872 : ' Remove_Reference ' : ambiguous symbol File: tesscallback.h Line : 1061
error C2872 : ' Remove_Reference ' : ambiguous symbol File: tesscallback.h Line : 1105
error C2872 : ' Remove_Reference ' : ambiguous symbol File: tesscallback.h Line : 1136
error C2872 : ' Remove_Reference ' : ambiguous symbol File: tesscallback.h Line : 1179
error C2872 : ' Remove_Reference ' : ambiguous symbol File: tesscallback.h Line : 1208

Software used:

MS visual studio 2012
Path to visual studio : " C : \ Program Files ( x86 ) \ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ devenv.exe "
OpenCV version: 2.4.8
OS: Windows 7 Home Premium , 64 -bit
Core i7
Tesseract version: tesseract - 2.3.02 - win32 - lib -include -dirs ( tested other versions )
Inguagem used : C + +11

Thanks for Help


回答1:


I have been in trouble for couple days with exactly the same problem (I am working on plate recognition project by using tesseract also) and I have just solved it. REMOVE "using namespaces XXX" CODE LINES FROM YOUR HEADER FILES(.h) (if causing an error in .h files tolerate them by using std::vector or cv::Mat etc) AND USE "using namespace XXX" CODE LINES IN YOUR SOURCE CODE(.cpp file).

I refered this link: http://bytes.com/topic/net/answers/456267-idataobject-ambiguous-symbol-error

and sorry about my ENGLISH :)




回答2:


I have solved the same problem by following method

// Specified by TR1 [4.7.2] Reference modifications.
// template <class T> struct remove_reference;
// template<typename T> struct remove_reference { typedef T type; };
// template<typename T> struct remove_reference<T&> { typedef T type; };



回答3:


The thing is that the latest C++ has a definition of remove_reference in std , and tesscallback.h contains another definition. When you use using namespace std, compiler will give an error due to redefinition.

You can either delete all using namespace std and use std:: (recommended and explained here) or uncomment all definitions of remove_reference in tesscallback.h.



来源:https://stackoverflow.com/questions/23740431/tesseract-remove-reference-ambiguous-symbol-in-project-on-visual-studio-2012

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!