jingweimo的个人博客分享 http://blog.sciencenet.cn/u/jingweimo

博文

Summary of the issues with Qt-OpenCV

已有 2889 次阅读 2018-2-8 02:12 |系统分类:科研笔记

1. C2039:  'UnicodeUTF8': is not a member of 'QApplication'

Solution: delete the argument 'QApplication::UnicodeUTF8))'

 

2. C1083: Cannot open include file: 'QtGui/QAction': No such file or directory

Solution: QAction is shifted to QtWidgets (this is true of many other modules)

//QT += widgets #put in .pro file

 

3. C2079: 'app' uses undefined class 'QApplication'

Solution: #include<QtWidgets/QApplication>

 

4. QObject::connect: No such slot ....

Solution: add Q_OBJECT at the top of the class declaration

 

5. LNK2001 unresolved external symbol

Solution: check if there exists QT+=widgets in the .pro file

 

6. LNK 1120 1 unresolved external symbol "bool __cdecl cv::imwrite....

Solution: add -lopencv_imgcodecs

 

7. LNK2019: unresolved external symbol "public ... cv::VideoCapture::VideoCapture

Solution: add -lopencv_videoio

 

other similar issues are reported here: https://stackoverflow.com/questions/18360540/error-lnk2019-unresolved-external-symbol-opencv


8. Error C2628: class followed by 'int' is illegal (did you forget a ';'?)

Solution:  add ; after the class definition

 

9. X is not a member of 'cv'

Solution: include "opencv2/imgproc.hpp" or other relevant module

 

10 Make sure 'Mat&' is registered using qRegisterMetaType()

Solution: Q_DECLARE_METATYPE(Mat) (https://forum.qt.io/topic/78818/make-sure-mat-is-registered-using-qregistermetatype-error/3


11. EXE crashed in image display with WINDOW_AUTOSIZE

 

12. LNK1105 cannot open opencv_world345d.obj

 

INCLUDEPATH += c:/opencv-3.4.5/prebuild/include
LIBS += -Lc:/opencv-3.4.5/prebuild/x64/vc14/lib
CONFIG(release, debug|release):{
    LIBS += -lopencv_world345
}
CONFIG(debug, debug|release):{
    LIBS += -lopencv_world345d
}


13. error C2872: 'ACCESS_MASK': ambiguous symbol

The problem is caused by putting "using namespace cv;" in a header.  If you need to define a class member that is part of the cv namespace in the header, use cv:: in front of the class name and move the using namespace to your cpp file. using namespace ... in a header should be discouraged but a workaround for ACCESS_MASK issue could be to include Windows.h stuffs before of OpenCV (http://answers.opencv.org/question/62079/access-mask-ambiguous-symbol/).

(see also https://stackoverflow.com/questions/39348845/c2870-ambiguous-symbol-error)


14. qt5svgd.dll is missing

The qt bin folder where qmake.exe is located may have not yet been added to Path.


Non-Qt related errors

1.  C2146: syntax error: missing ... before identifier ...

Solution: comment #include<windows.h> in the .h file (https://en.wikipedia.org/wiki/Windows.h

2. C3861 'identifier': identifier not found

The compiler was not able to resolve a reference to an identifier. To fix this error, compare use of identifier to the identifier declaration for case and spelling. Verify that scope resolution operators and namespace using directives are used correctly (https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-2/compiler-error-c3861?view=vs-2017).


15. C2236: unexpected 'class'

Solution: Some semi-colons may be ommited after the class declaration

 

Sources:

https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5

https://forum.qt.io/topic/28054/unicodeutf8-not-member-qapplication-generated-with-qt5-designer/7

https://stackoverflow.com/questions/14069041/unresolved-external-symbols-qt-creator

http://answers.opencv.org/question/78727/lnk1120-lnk2019/

https://stackoverflow.com/questions/31169779/videocapture-error-opencv-3-0-0-in-visual-studio-2013-in-c

https://docs.opencv.org/3.2.0/db/dfa/tutorial_transition_guide.html

https://stackoverflow.com/questions/12206314/detect-if-visual-c-redistributable-for-visual-studio-2012-is-installed

https://wiki.qt.io/How_to_setup_Qt_and_openCV_on_Windows

http://www.bogotobogo.com/Qt/



 



https://blog.sciencenet.cn/blog-578676-1098897.html

上一篇:First Applications with QT
下一篇:Create Qt widgets
收藏 IP: 35.10.57.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-3 20:11

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部