Search code examples
qtopenglopenmesh

Qt error in .obj file: unresolved externals


So I have changed the following lines:

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

LIBS += \
    -lglut -lGLU

to:

LIBS += \
    -lglut32 -lOpenMeshCored -lOpenMeshToolsd

and then I encounter these error:

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

Solution

  • It looks like your OpenMesh library is 64-bit and you are trying to link it with a 32-bit glut library, which is not possible. You have two options:

    1. Don't use glut32, and use 64-bit glut library.
    2. If you need a 32-bit binary, change all your other libs to 32-bit version as well. And to run the 32-bit application on Linux (which seems you're on), you may need to add i386 architecture (see here for more info).