PDA

View Full Version : A question about compiling in debug mode and in release mode



Yogibear
5th October 2007, 20:30
Hello to all

I know this might be a stupid question for some but what is the difference between compiling in release and debug mode.This should not affect the final executable file ??.
Is it necessary to compile in debug mode.:o

Yours Respectfully

jacek
5th October 2007, 20:44
It will affect the executable. Debug mode is necessary for debugging with a debugger (unless you like reading assembler code). If you compile your project in this mode, it will contain additional information for the debugger and also it enables some checks inside Qt, that will allow you to identify problems more easily.

Yogibear
5th October 2007, 22:33
The reason why i asked is because when i build the Qt libraries in debug mode i get this at the end:
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Qt is now configured for building. Just run mingw32-make.
To reconfigure, run mingw32-make confclean and configure.
(cd C:\Qt\4.3.1\src\winmain && mingw32-make -f Makefile debug)
mingw32-make[1]: Entering directory `C:/Qt/4.3.1/src/winmain'
mingw32-make -f Makefile.Debug
Makefile.Debug:116: *** multiple target patterns. Stop.
mingw32-make[2]: Entering directory `C:/Qt/4.3.1/src/winmain'
mingw32-make[2]: Leaving directory `C:/Qt/4.3.1/src/winmain'
mingw32-make[1]: *** [debug] Error 2
mingw32-make[1]: Leaving directory `C:/Qt/4.3.1/src/winmain'
mingw32-make: *** [debug-C__Qt_4_3_1_src_winmain] Error 2
C:\Qt\4.3.1\src>


What does this mean especially where the lines mention "error"Also in the C:\Qt\examples..... There are no files in the "debug" folder,only in the "release" folder.
Does this mean that the building of the debug libraries failed?

When I run command "make release" i get a perfect executable in the release folder.

However when I type "make debug" or "make" I get the following error


C:\works>make debug
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/works'
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
oc -mthreads -Wl -Wl,-subsystem,windows -o "debug\works.exe" debug\yogi.o -L"c:
\Qt\4.3.1\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\ mingw32\bin\ld.exe: cannot fin
d -lqtmaind
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\works.exe] Error 1
mingw32-make[1]: Leaving directory `C:/works'
mingw32-make: *** [debug] Error 2

C:\works>

I am a bit fedup trying to resolve this,so guys please help me out.:(

Yours Respectfully

Michiel
5th October 2007, 22:44
Not sure about the error. But there is one more difference between debug mode and release mode for compilers. Debug mode generally compiles faster and runs slower than release mode.

wysota
6th October 2007, 00:40
Debug mode generally compiles faster and runs slower than release mode.

It's because release mode does by default much more optimisations. That's why it is called release - when you are releasing a project, you compile in release mode. Contrary to that you compile in debug mode when you debug.

@Yogibear: You don't have debug libraries built (the "d" at the end of the library name marks it as debug).

jacek
7th October 2007, 23:04
when i build the Qt libraries in debug mode i get this at the end:[...]
What commands did you issue exactly?

Yogibear
8th October 2007, 22:21
I am using windows so I just go to the shortcut in programs and click on Qt and then click on build debug libraries(command prompt) and just type "y" to agree to the license and just let the program run until it stops at this error.

Did i do something wrong?

jacek
8th October 2007, 23:45
Did i do something wrong?
No, it seems that you are experiencing the same problem as in this thread: http://www.qtcentre.org/forum/f-installation-5/t-want-a-stable-install-9457.html

Yogibear
10th October 2007, 18:20
I have suceeded,thanks to all:):)