开发者

:: error: collect2: ld returned 1 exit status with QT and opengl

I'm trying to use a QGLWidget in a QT application, and I've added the "QT += opengl" line into the .pro file but I am now getting :: error: collect2: ld returned 1 exit status when I attempt to compile my program

the compile output shows the following,

Running build steps for project MapEditor...
Configuration unchanged, skipping qmake step.
Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `C:/Qt/2010.05/MapEditor-build-desktop'

C:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug

mingw32-make[1]: Entering directory `C:/Qt/2010.05/MapEditor-build-desktop'

g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\MapEditor.exe debug/Main.o debug/window.o debug/glwidget.o debug/moc_window.o debug/moc_glwidget.o  -L"c:\Qt\2010.05\qt\lib" -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmaind -lQtOpenGLd4 -lQtGuid4 -lQtCored4 

mingw32-make[1]: Leaving directory `C:/Qt/2010.05/MapEditor-build-desktop'

mingw32-make: Leaving directory `C:/Qt/2010.05/MapEditor-build-desktop'

debug/moc_glwidget.o:moc_glwidget.cpp:(.rdata$_ZTV8GLWidget[vtable for GLWidget]+0x14): undefined reference to `GLWidget::~GLWidget()'

debug/moc_glwidget.o:moc_glwidget.cpp:(.rdata$_ZTV8GLWidget[vtable for GLWidget]+0x18): undefined reference to `GLWidget::~GLWidget()'

debug/moc_glwidget.o:moc_glwidget.cpp:(.rdata$_ZTV8GLWidget[vtable for GLWidget]+0x118): undefined reference to `non-virtual thunk to GLWidget::~GLWidget()'

debug/moc_glwidget.o:moc_glwidget.cpp:(.rdata$_ZTV8GLWidget[vtable for GLWidget]+0x11c): undefined reference to `non-virtual thunk to GLWidget::~GLWidget()'

collect2: ld returned 1 exit status

mingw32-make[1]: *** [debug\MapEditor.exe] Error 1

mingw32-make: *** [debug] Error 2

The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2. Error while building project MapEditor (target: Desktop) When executing build step 'Make'

and my开发者_运维知识库 .pro file contains the following,

TARGET = MapEditor
TEMPLATE =app

QT += opengl

SOURCES += \
    Main.cpp \
    window.cpp \
    glwidget.cpp

HEADERS += \
    window.h \
    glwidget.h


Check you .pro file (i.e. project file) that u have added all the class files and header files in SOURCES and HEADERS tags.[For this purpose run qmake command from build menubar options] Also check that u have declared the Q_OBJECT macro in the starting of your glwidget class.


It looks like some file is missing. Did you add this to your header?

 #include <QtOpenGL>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜