This site is support & information site of WEB,and Software. This site might help you that create software or Web Site…perhaps?[:]

Qt (11) How to debug with Qt Creator and VC++ Compiler.

Published on| August 28th, 2009 | No Comment.
This time, Qt Creator I would like a brief description.
Qt Creator is, Qt SDK is one of, Qt to create an integrated environment for application development (IDE) for that.
Integrated development environment (IDE) is to say, Qt Creator itself, the compiler is not bundled with its own. Using Qt Creator, Windows If you are developing in, MinGw are included by default (if the binary environment).
Linux, Unixes, Mac OS does, gcc is so equipped, the compiler will use it.

In this way, Qt Creator is, gcc was only supposed to work with the system compiler. (For details, VC + + but I was able to compile, debug failed. )
However, in version 1.2 or later, Windows environments, VC + + using the compiler, the execution of the compilation, you can now debugging.

This time, about their preferences, I would like to brief notes.

Download Qt Creator: Http://Qt.nokia.com/Downloads
At the bottom "Qt Creator IDE" You and I, please download it from there.

Download Debugging Tools for Windows 32bit Version: http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx
Download Debugging Tools for Windows 64bit Version: http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx

Page Ref: Http://Doc.trolltech.com/Qtcreator-1.2/Creator-Debugging.html
First, Qt Creator let the latest version.
Here, Qt Creator to Visual Studio 2008 (C + +) using the compiler, so you want to use, as reference the following articles, all leave the VC + + 2008 compilation.

Reference article: VC + + 2008 Express to compile the sample using the Qt Preferences

The latest version of the above as if compiled with VC + + 2008, I have a small mistake,如何Sen, takes time to implement all compiled.
However, Qt Creator is what the previous version 1.2, you need to update to the latest.
If so, download the source code only.
※ The above can be downloaded from the download where to download the source code.

Binary, MinGW it is compiled, you really tend to be unstable.
As possible, what the latest VC + + is recommended that you compile.

On how to build when you download the source code, you'll easily described.
(Visual Studio 2008) from the command prompt, Qt can be compiled as described in the application.

  1. Source code to extract the downloaded ZIP file.
    Cases)% Qt installation% \ qt-creator-1.xx-src \
    As understandable,% Qt% we recommend the installation to extract.

  2. (Visual Studio 2008) and enter the following command from a command prompt.
    ※ current directory after you switch to extract the target, run the following command.
    %Qt Install Dir%\qt-creator-1.x.x-src> qmake qtcreator.pro
    %Qt Install Dir%\qt-creator-1.x.x-src> nmake release
    %Qt Install Dir%\qt-creator-1.x.x-src> 

    namke about to finish takes about 1-2 hours.

    Do not forget the parameters nmake.
    Would have been created with the debug version does not specify anything.
    Debug version, so unusually slow, your attention.

Especially if there is no problem,% Qt installation% \ qt-creator-1.xx-src \ bin \ qtcreator.exe I think that the file has been created.

Let's set the environment for Qt Creator.
Preferences before Qt Creator, Debugging Tools for Windows installed.
From which you downloaded above to download it was in the machine environment.
Installation in accordance with the installation installer.
No need to set something special. I just installed a full explanation will be omitted.

Well, then, Qt Creator is a set.
Qtcreator.exe created before the latest run.
※ qtcreator.exe double-clicking from Windows Explorer directly start.

Since Qt is the same as a normal application, QtCore4.dll, QtGui4.dll not work and not to the other path is set.
If you do not want to set the path, QtCore4.dll, QtGui4.dll necessary to copy the same directory as your DLL.

Tools - Options - [Qt4] - [Qt Versions] Open.

Here, Qt if different version appears in the combo box.

Qt want to set as the default version of the doubt. Also, choose from a list that the version of Qt. VC + + If you compile with the compiler here, VC + + compiler will be displayed.

Otherwise, MinGW will only see it, the Qt library, VC + + does not work.

Here, VC + + If there are multiple versions of multiple combo box will appear, select the version here as well with no mistakes.

Finally, make sure that the debugging environment is set correctly.
Tools - Options - Debugger - [Cdb] Open.

Thus if the Debugging Tools for Windows installation is set up is OK.
If not set, if so, click the Browse button, Debugging Tools for Windows to specify the installation directory.

Far, Once set, once, Qt Creator Naoshimashou launched.

Try to debug Qt Creator.
Create a simple Qt application.
File - New - [Qt GUI Applications Select.

Once you have selected, OK button.

Since the test, set the appropriate project name.
Once you have selected, Next button.

Because the test will remain the default settings.
Once you have selected, Next button.

Because the test will remain the default settings.
Once you have selected, Next button.

This screen is the final confirmation screen.
After the confirmation, click Finish.

The screen displays are created and managed the project.

Also to create a project like this, VC + + does not change much with the operation.
Debugging operations VC + + does not change much after the operation.
VC + + If you are familiar with, and can operate smoothly.

Build, Build - [Build All] Do all the compiling and linking.

In this case, the information output during the build, does not appear automatically. (Per this, I feel I have no mind. )
In doing so, the output displayed when you click the button below to compile the bottom right.

(If you do not compile on the output is) at the end of all errors, warnings are displayed automatically.

The following is finally debugging.
First, main.cpp open, let's set a breakpoint in the appropriate place.
Have a cursor to go to break, where Debug - [Toggle breakpoint] Red circle appears when you click the cursor on the line.

Debug - Start Debugging - Start Debugging When you click to run debug.
Should stop at the first breakpoint locations.

It easily Nozokemasu contents of local variables.

Step, step also allows menu operations as well.
The debug function key assignments, VC + + 6.0 is similar to key binding so, you're familiar with it, we can use without discomfort.

If you include the specific source WIN32, by default, Windows will not link the standard library.
If you require WIN32 specific process, the project file (. Pro), and direct and will be able to add the following link.

LIBS + = kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

In addition, Windows also if you want to compile a resource file, as well as the project file (. Pro), and direct and will be able to add the following compilation.

RC_FILE + = xxxx.rc

xxxx.rc: resource file

What's wrong is not known but, sometimes, when you debug environment on my machine, at the start had to be locked at the end of the PC.
After a while (several minutes), returns to the original (maybe, but what I thought Naa debugger can not stop now). Yet, some, I might have some na Toko unstable.
However, project management and resources, to create the screen, can in-one is very attractive.
And, of course, MinGW and is even faster than the speed of compilation, I think faster debugging. (It is my personal impression. )

Once I tried to be good.
's Time, Qt and feel like they have to withstand even the full-scale use.

(loadposition QTAmazon)

  • はてなブックマークへ追加する
  • Facebookでシェアする
  • twitter でつぶやく
  • Google Plusでシェアする
  • Pocketでシェアする