Now that we finally have set up our programming tools it is time for a short functional test before we start with the core of the programming tutorial.
If the C++ development tools and the Qt SDK have been installed correctly, the Qt IDE should be able to run and we should also be able to compile and run an example program.
The starting point for this test as well as for all future programming activities is the central Qt IDE (integrated development environment) application which is called Qt Creator:
The MacOS X version of the QtSDK installer for the former version 4.8 seemed to have a bug (which is not present in Qt version 5):
If you get an error after starting Qt Creator on Mac OS X with a message like "Cannot create/overwrite file <your home directory>/.config/Nokia/qtversion.xml" it means that the installer did not create the "/.config/Nokia/" directory with the correct access rights settings.
This can be fixed in the following way:
After this procedure, you can close the terminal application and start
the Qt Creator application anew. The error should not come up again this
time (if the directory access rights have been changed correctly).
I will explain the different parts of the Qt Creator development environment in the next part of my C++ programming tutorial.
For now, let's go to the "Qt Welcome" screen and switch to the "Demos and Examples" subsection. Here, scroll down a little in order to find the "Address Book Example":
After selecting and confirming this example, a new window will pop up where you can set the target options for the new project:
Just use the default options here and click on the "Finish" button.
After a short wait the extra window will disappear and the Qt Creator will switch to a display with the new address book project in edit mode.
By clicking on the green triangle button or selecting the appropriate option from the Qt Creator menu, the address book example application will be compiled, build and started.
If the installed C++ and Qt tools work correctly, you should see the main window of the address book application:
After this first start of the application, it will display a message stating that no contact addresses have been entered yet, so no data can be displayed.
By clicking on the "Add" button, you can bring up an additional window where a new address can be entered:
After entering a new name and address and clicking on the "OK" button, you can select the relevant alphabetical character tab in the main window. Now you should see a list containing the address you just entered:
If everything works fine, you can play around with the example application. When you are done, simply select the "Exit" option from the file menu.
If the application did not start and you get some error message, please read the error message carefully. Normally the error message should give you some idea what to change in order to get a positive result.
If the Qt Creator does not start, you should check the installation steps described above. Maybe you missed a step or completed one step earlier than it should have been done. If in doubt, simply uninstall the Qt development environment first and then uninstall the C++ development tools. After that, reinstall the C++ development tools first and then the Qt development environment as described above.
I cannot explain all possible error conditions and how to fix them here. Some errors might be tied to the Qt development environment, others may be based on the C++ tools which you are using.
If reinstalling the C++ development tools and the Qt development environment does not fix your problem you should look up the error and/or relevant key words on the help sites and forums for both in the web.
I hope your installation was successful so far. If this is the case I hope to see you again in the next part of this programming tutorial for a more detailed overview of the Qt development environment.
After that, we will dive into the programming sea to get our feet wet (and more)...