puzzlepaint / surfelmeshing

Real-time surfel-based mesh reconstruction from RGB-D video.
BSD 3-Clause "New" or "Revised" License
420 stars 83 forks source link

error: ‘AA_DontCheckOpenGLContextThreadAffinity’ is not a member of ‘Qt’ #10

Closed Quitino closed 4 years ago

Quitino commented 4 years ago

hello @puzzlepaint Thanks for sharing the code. I met the following error when I tried to compile your code:

surfelmeshing/libvis/src/libvis/opengl_context_qt.cc: In member function ‘virtual void vis::OpenGLContextQt::MakeCurrent()’:
/home/fb/SLAM/surfelmeshing/libvis/src/libvis/opengl_context_qt.cc:126:46: error: ‘AA_DontCheckOpenGLContextThreadAffinity’ is not a member of ‘Qt’
   QCoreApplication::instance()->setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity);
                                              ^
CMakeFiles/libvis.dir/build.make:270: recipe for target 'CMakeFiles/libvis.dir/libvis/src/libvis/opengl_context_qt.cc.o' failed
make[3]: *** [CMakeFiles/libvis.dir/libvis/src/libvis/opengl_context_qt.cc.o] Error 1

I have tried with QT5.5.1and Qt5.9.1 and have the above errors.Maybe I have installed the QT with errors?

Any idea of why there's such a problem? Thanks in advance!

puzzlepaint commented 4 years ago

According to the Qt documentation, Qt::AA_DontCheckOpenGLContextThreadAffinity was added in Qt 5.8. Thus, it seems like the attempt to use Qt 5.9.1 probably didn't work correctly. Probably it still used the Qt 5.5.1 headers for some reason. Correctly using Qt 5.9.1 should solve the issue.

liujiacheng1009 commented 4 years ago

I changed to Qt5.10.1, and solved the error

wangjunfeng90214 commented 4 years ago

modify the opengl_context_qt.cc file change the code QCoreApplication::instance()->setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity); to

if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)

// todo

else

QCoreApplication::instance()->setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity);

endif