PDA

View Full Version : compiling errors when using opengl and debug



invictus
29th March 2008, 23:55
Hi

I am trying to get myself som debugging information from the application I am creating and in the project file I added:


QT += opengl debug
CONFIG += console

and then used qDebug() at the appropriate places within my code. However when I "make" the program I get the following error:


g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
oc -Wl,-s -Wl,-subsystem,console -mthreads -Wl -o release\gl.exe release/GLWidge
t.o release/GLWindow.o release/main.o release/moc_GLWidget.o -L"c:\Qt\4.3.4\lib
" -lopengl32 -lglu32 -lgdi32 -luser32 -lQtOpenGL4 -lQtGui4 -lQtCore4
/mingw/lib/libmingw32.a(main.o)(.text+0x106):main.c: undefined reference to `Win
Main@16'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [release\gl.exe] Error 1

If I instead try to compile with "make debug" I get the following error:


g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
oc -Wl,-subsystem,console -mthreads -Wl -o debug\gl.exe debug/GLWidget.o debug/G
LWindow.o debug/main.o debug/moc_GLWidget.o -L"c:\Qt\4.3.4\lib" -lopengl32 -lgl
u32 -lgdi32 -luser32 -lQtOpenGLd4 -lQtGuid4 -lQtCored4
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\ mingw32\bin\ld.exe: cannot fin
d -lQtOpenGLd4
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\gl.exe] Error 1


This is getting waaaay confusing for me. I have no idea what either of these means. All I am trying to do is to get some easy access to information from my app while I write it, but QT isn't making it easy for me unfortunately...

Any help?

jpn
30th March 2008, 12:37
After adding "CONFIG += console" you have to force a rebuild (make clean or delete at least main.o). Do you have the debug version of Qt compiled? Notice the shortcut in Start-menu (provided that you used the installer).

invictus
31st March 2008, 00:13
After adding "CONFIG += console" you have to force a rebuild (make clean or delete at least main.o). Do you have the debug version of Qt compiled? Notice the shortcut in Start-menu (provided that you used the installer).

Apparently I did not have that. Do I need it?

Seems like making clean worked excellent for release at least :) Thanks!

jpn
31st March 2008, 07:16
Apparently I did not have that. Do I need it?
The open source version of Qt/Win does not come with debug libraries by default. One has to build them separately by following the link in Start-menu. And yes, you need them for compiling Qt projects in debug mode.