GillesDebunne / libQGLViewer

libQGLViewer is an open source C++ library based on Qt that eases the creation of OpenGL 3D viewers.
Other
245 stars 94 forks source link

[Windows10 - Qt 5.5.1 MSVC2013 64bits] Error during execution of the examples #23

Closed naubry closed 8 years ago

naubry commented 8 years ago

Hello,

I have compiled the library with Qt Creator. I have obtained some files like QGLViewer2.dll, QGLViewerd2.dll, QGLViewer2.lib and QGLViewerd2.lib.

After that, I compiled the various examples without error but when I execute one of these, I get this error every time : QWidget: Must construct a QApplication before a QWidget

I have compiled library and examples in the debug profil in Qt Creator 3.6 ; Besides, I am quite confused by the fact that we get the both (debug and release version of the library) when we are in the debug profil in Qt Creator or I missed something ?!

naubry commented 8 years ago

I have solved my issue. I replaced in the examples.pri file the following expression :

win32 {
    CONFIG *= debug_and_release

    # Seems to be needed for Visual Studio with Intel compiler
    DEFINES *= WIN32

    # Use native OpenGL drivers with Qt5.5
    # No longer implicit since the ANGLE driver is now an alternative
    LIBS += -lopengl32 -lglu32

    isEmpty( QGLVIEWER_STATIC ) {
        LIBS *= -L$${LIB_DIR} -lQGLViewer2
    } else {
        DEFINES *= QGLVIEWER_STATIC
        LIBS *= $${LIB_DIR}/libQGLViewer2.a
    }
}

by this :

win32 {
    # Seems to be needed for Visual Studio with Intel compiler
    DEFINES *= WIN32

    # Use native OpenGL drivers with Qt5.5
    # No longer implicit since the ANGLE driver is now an alternative
    LIBS += -lopengl32 -lglu32

        CONFIG(debug, debug|release) {
            isEmpty( QGLVIEWER_STATIC ) {
                LIBS *= -L$${LIB_DIR} -lQGLViewerd2
            } else {
                DEFINES *= QGLVIEWER_STATIC
                LIBS *= $${LIB_DIR}/libQGLViewerd2.lib
            }
        } else {
            isEmpty( QGLVIEWER_STATIC ) {
                LIBS *= -L$${LIB_DIR} -lQGLViewer2
            } else {
                DEFINES *= QGLVIEWER_STATIC
                LIBS *= $${LIB_DIR}/libQGLViewer2.lib
            }
        }
}
GillesDebunne commented 8 years ago

thanks for this feedback. I do not have a windows machine to try this out, so I think I'll blindly fix the .pro from your code.

On Mon, Jan 18, 2016 at 6:56 PM, AUBRY Nicolas notifications@github.com wrote:

I have solved my issue. I replaced in the examples.pri file the following expression :

win32 { CONFIG *= debug_and_release

Seems to be needed for Visual Studio with Intel compiler

DEFINES *= WIN32

Use native OpenGL drivers with Qt5.5

No longer implicit since the ANGLE driver is now an alternative

LIBS += -lopengl32 -lglu32

isEmpty( QGLVIEWER_STATIC ) { LIBS = -L$${LIB_DIR} -lQGLViewer2 } else { DEFINES = QGLVIEWER_STATIC LIBS *= $${LIB_DIR}/libQGLViewer2.a }

}

by this :

win32 {

Seems to be needed for Visual Studio with Intel compiler

DEFINES *= WIN32

Use native OpenGL drivers with Qt5.5

No longer implicit since the ANGLE driver is now an alternative

LIBS += -lopengl32 -lglu32

CONFIG(debug, debug|release) {
    isEmpty( QGLVIEWER_STATIC ) {
        LIBS *= -L$${LIB_DIR} -lQGLViewerd2
    } else {
        DEFINES *= QGLVIEWER_STATIC
        LIBS *= $${LIB_DIR}/libQGLViewerd2.lib
    }
} else {
    isEmpty( QGLVIEWER_STATIC ) {
        LIBS *= -L$${LIB_DIR} -lQGLViewer2
    } else {
        DEFINES *= QGLVIEWER_STATIC
        LIBS *= $${LIB_DIR}/libQGLViewer2.lib
    }
}

}

— Reply to this email directly or view it on GitHub https://github.com/GillesDebunne/libQGLViewer/issues/23#issuecomment-172606659 .