Step 7: Test of the development setup

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:

Screenshot of Qt Creator Welcome page

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:

  1. Open the "Terminal" application which can be found in the /Applications/Utilities/ folder on your harddrive.
  2. Enter the command "sudo -s" after getting the prompt in the terminal window. You will then be asked to enter the system administrator password for your Mac.
  3. Enter the command "pwd" in order to check the current directory path. By default this should be "/Users/<< username >>" (with "<< username >>" replaced by the name of your default user).
  4. From your user home directory, enter the command "cd .config" in order to go to the config directory. If the "pwd" command showed another directory than your user home directory, enter the command "cd /Users/<< username >>/.config" (again with your standard username replacing "<< username >>").
  5. Check the settings for the "Nokia" subdirectory here by entering the command "ls -l Nokia". The problem here is the setting of "root" as the owner of the directory.
  6. Now enter "chown -R Nokia/ << username >>" into the command line inside the terminal window, with your standard user replacing "<< username >>".
  7. If you now check the settings again by entering "ls -l Nokia", the owner of the subdirectory (and the files inside it) should be your own user instead of "root".

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":

Screenshot of Qt Creator Demos and Examples page

After selecting and confirming this example, a new window will pop up where you can set the target options for the new project:

Screenshot of Qt Project target setup after selection of addressbook example

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:

Screenshot of runnig addressbook example 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:

Screenshot of add contact dialog in addressbook example program

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:

Screenshot of list display in addressbook program with new address entry

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.

Final words

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)...




Enjoy this page? Please pay it forward. Here's how...

Would you prefer to share this page with others by linking to it?

  1. Click on the HTML link code below.
  2. Copy and paste it, adding a note of your own, into your blog, a Web page, forums, a blog comment, your Facebook account, or anywhere that someone would find this page valuable.