libQGLViewer和g2o版本

libQGLViewer2.6.2

libQGLViewer2.6.2 和 QT5.6.3编译时候会出错,初步判断libQGLViewer2.6.2不支持QT5

错误    73    error LNK1120: 50 个无法解析的外部命令    D:\Packages\G2O\libQGLViewer-2.6.2\QGLViewer\debug\\QGLViewerd2.dll    QGLViewer
错误    6    error LNK2001: 无法解析的外部符号 __imp__glBegin@4    D:\Packages\G2O\libQGLViewer-2.6.2\QGLViewer\keyFrameInterpolator.obj    QGLViewer
错误    7    error LNK2001: 无法解析的外部符号 __imp__glBegin@4    D:\Packages\G2O\libQGLViewer-2.6.2\QGLViewer\qglviewer.obj    QGLViewer
错误    39    error LNK2001: 无法解析的外部符号 __imp__glDisable@4    D:\Packages\G2O\libQGLViewer-2.6.2\QGLViewer\qglviewer.obj    QGLViewer
错误    9    error LNK2001: 无法解析的外部符号 __imp__glEnd@0    D:\Packages\G2O\libQGLViewer-2.6.2\QGLViewer\keyFrameInterpolator.obj    QGLViewer
错误    10    error LNK2001: 无法解析的外部符号 __imp__glEnd@0    D:\Packages\G2O\libQGLViewer-2.6.2\QGLViewer\qglviewer.obj    QGLViewer
错误    12    error LNK2001: 无法解析的外部符号 __imp__glFrustum@48    D:\Packages\G2O\libQGLViewer-2.6.2\QGLViewer\saveSnapshot.obj    QGLViewer
错误    41    error LNK2001: 无法解析的外部符号 __imp__glLineWidth@4    D:\Packages\G2O\libQGLViewer-2.6.2\QGLViewer\qglviewer.obj    QGLViewer
错误    14    error LNK2001: 无法解析的外部符号 __imp__glLoadIdentity@0    D:\Packages\G2O\libQGLViewer-2.6.2\QGLViewer\qglviewer.obj    QGLViewer

libQGLViewer2.7.0

libQGLViewer2.7.0和g2o20160427和g2o20170730不兼容

错误    19    error C2039: “updateGL”: 不是“g2o::G2oQGLViewer”的成员    

原因分析
libQGLViewer2.7.0更新如下导致出现此问题,导致最后g2o_viewer库难以生成

QGLViewer extends QOpenGLWidget instead of the deprecated QGLWidget (huge thanks to Gianluca).
Although there are minor differences between the two classes, the switch should be mostly invisible.
Using update() instead of updateGL() is one of them.
The renderText methods were backported to maintain backward compatibility.
Some overloaded constructors (using a QGLFormat or a sharedWidget) are deprecated since they have no equivalent.

解决方式:将报错中updateGL()替换成update()即可顺利编译生成g2o_viewer

当前方案

libQGLViewer2.6.3版本既支持QT5又和2o20160427和g2o20170730兼容

posted @ 2021-06-29 10:30  采男孩的小蘑菇  阅读(326)  评论(0编辑  收藏  举报