Eclipse + Qt - Troubleshooting
This document deals with the installation and configuration of Eclipse and Qt.
It addresses the developer who is familiar with C++ and Qt basics, but not with developing using Eclipse.
Installation
Beside Eclipse itself and in order to move it to compile and spit out C++ and not Java, you need the following packages:
- Eclipse [During the creation of this document the current version available is 3.2]
- The C++ plugin CDT [To get it working together with Eclipse 3.2 CDT version 3.1 is needed.]
- Qt for Windows
- MinGW for Windows
After installing Eclipse it will not work using a non-administative account. In order to fix that you have to modify the link that starts Eclipse the following way:
C:\Programme\eclipse\eclipse.exe -data "%USERPROFILE%\workspace".
To install the CDT, you open Eclipse and go Help -> Software Updates -> Find and Install.
In the following dialog "Feature Updates" you choose Search for new features to install.
In the following dialog "Update sites to visit" you add a New Remote Site with Name "Callisto CDT" and URL "http://download.eclipse.org/tools/cdt/releases/callisto".
After adding, select the new entry and push Finish.
Install Qt and MinGw. Don't change the installation paths. This will prevent you from trouble.
Next, the system's path variable must be extended with the paths needed to develop with Qt:
- C:\Qt4.1.3\bin
- C:\MinGW\bin
Now we want to build the Qt debug libraries. To do so, go Start -> Programs -> Qt -> Qt (Build Debug Libraries).
Creating a project
Now it's getting dirty for those who are used in developing with Visual Studio :-)
- Create a new Standard Make Project.
-
In the following dialog "Project Properties"
- switch to the Make Builder tab and set the Build Command to "mingw32-make".
-
Switch to the "Environment" tab and add the following two variables:
The values for each variable you'll get from a file named qtvars.bat. It should be located in the bin directory of your Qt installation.
- Switch to the Binary Parser tab and select the PE Windows Parser from the list.
- Finish the dialog and the project will be created.
- Add headers and sources to your project.
If you need help concerning the general architecture of a Qt application, see the Qt tutorials for a simple Hello-World example.
-
In the "Make Targets" view you add a new target clicking the project name right, and choosing Add Make Target.
- This target will create us a project file. So set Name to "pro".
- Set the Make Target to "-project".
- Set the Build Command to "qmake".
After adding, click the new target right and choose Build Make Target to create a project file.
-
Add a second target clicking the project name right, and choosing Add Make Target.
- This target will create us a make file. So set Name to "make".
- Clear the value of Make Target.
- Set the Build Command to "qmake".
After adding, click the new target right and choose Build Make Target to create a make file.
-
Add a third target clicking the project name right, and choosing Add Make Target.
- This target will create us a binary file. So set Name to "bin".
- Clear the value of Make Target.
- For the Build Command take the standard value "mingw32-make".
After adding, click the new target right and choose Build Make Target to create an executable file.
- Now we'd like to debug our application. Click the debug button from the toolbar, select C/C++ Application from the treeview on the left and push the New Launch Configuration button. A new debug config menu will be created on the right. On the Main tab, you have to specify your executable file in the box C/C++ Application. Open the Search dialog and the file you built should be listed. Select it and push the Debug button.
- In order to run your application without debugging, click the Run button from the toolbar and do the same steps as in the Debug Menu.
Now the configuration should work and you may care about your real problems ...
If you still have trouble, you may contact me here.