.obj文件中的Qt错误:未解析的外部

.obj文件中的Qt错误:未解析的外部,qt,opengl,openmesh,Qt,Opengl,Openmesh,因此,我更改了以下行: LIBS += \ /usr/local/lib/libOpenMeshCore.so \ /usr/local/lib/libOpenMeshTools.so LIBS += \ -lglut -lGLU 致: 然后我遇到了以下错误: QGLViewerWidget.obj:-1: error: LNK2019: unresolved external symbol __imp_glutWireTeapot referenced in fu

因此,我更改了以下行:

LIBS += \
    /usr/local/lib/libOpenMeshCore.so  \
    /usr/local/lib/libOpenMeshTools.so

LIBS += \
    -lglut -lGLU
致:

然后我遇到了以下错误:

QGLViewerWidget.obj:-1: error: LNK2019: unresolved external symbol __imp_glutWireTeapot referenced in function "protected: virtual void __cdecl QGLViewerWidget::draw_scene(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)"

QGLViewerWidget.obj:-1: error: LNK2019: unresolved external symbol __imp_glutSolidTeapot referenced in function "protected: virtual void __cdecl QGLViewerWidget::draw_scene(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)"

meshviewer.obj:-1: error: LNK2019: unresolved external symbol __imp___glutInitWithExit referenced in function glutInit_ATEXIT_HACK
QGLViewerWidget.obj:-1:错误:LNK2019:未解析的外部符号_imp_glutwiretapot在函数“protected:virtual void _cdecl QGLViewerWidget::draw_scene(类std::basic_string const&)”中引用
QGLViewerWidget.obj:-1:错误:LNK2019:未解析的外部符号uu imp_uglutsolidteapot在函数“protected:virtual void\uu cdecl QGLViewerWidget::draw\u scene(类std::basic\u string const&)”中引用
meshviewer.obj:-1:错误:LNK2019:函数glutInit\U ATEXIT\U HACK中引用的EXIT未解析的外部符号

看起来您的OpenMesh库是64位的,您试图将其与32位glut库链接,但这是不可能的。您有两个选择:

  • 不要使用glut32,而是使用64位glut库
  • 如果需要32位二进制文件,请将所有其他lib也更改为32位版本。要在Linux上运行32位应用程序(看起来您正在运行),您可能需要添加
    i386
    体系结构(有关更多信息,请参阅)

  • 你们有我可以下载glut64的网站吗?我一直在搜索glut64和glu。顺便说一句,我在我的另一个程序中使用了glut32,效果很好。但正如您所提到的,它可能与openmesh库存在兼容性问题。而且,我使用的是windows而不是linux。@elladeguzman有一些地方人们已经为windows编译了64位过量,例如。但是,glut许可证不允许重新编译,这使得它不可用。您可能很幸运地使用了qt,但我的建议是使用最新版本的qt,我相信它不会有过量依赖性。
    QGLViewerWidget.obj:-1: error: LNK2019: unresolved external symbol __imp_glutWireTeapot referenced in function "protected: virtual void __cdecl QGLViewerWidget::draw_scene(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)"
    
    QGLViewerWidget.obj:-1: error: LNK2019: unresolved external symbol __imp_glutSolidTeapot referenced in function "protected: virtual void __cdecl QGLViewerWidget::draw_scene(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)"
    
    meshviewer.obj:-1: error: LNK2019: unresolved external symbol __imp___glutInitWithExit referenced in function glutInit_ATEXIT_HACK