Game Programming using Qt 5 Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Setting up compilers, Qt versions, and kits

Before Qt Creator can build and run projects, it needs to know which Qt builds, compilers, debuggers, and other tools are available. Fortunately, Qt installer will usually do it automatically, and Qt Creator is able to automatically detect tools that are available system-wide. However, let's verify that our environment is properly configured. From the Tools menu, choose Options. Once a dialog box pops up, choose Build & Run from the side list. This is the place where we can configure the way Qt Creator can build our projects. A complete build configuration is called a kit. It consists of a Qt installation and a compiler that will be executed to perform the build. You can see tabs for all the three entities in the Build & Run section of the Options dialog box.

Let's start with the Compilers tab. If your compiler was not autodetected properly and is not in the list, click on the Add button, choose your compiler type from the list, and fill the name and path to the compiler. If the settings were entered correctly, Creator will autofill all the other details. Then, you can click on Apply to save the changes.

Next, you can switch to the Qt Versions tab. Again, if your Qt installation was not detected automatically, you can click on Add. This will open a file dialog box where you will need to find your Qt installation's directory, where all the binary executables are stored (usually in the bin directory), and select a binary called qmake. Qt Creator will warn you if you choose a wrong file. Otherwise, your Qt installation and version should be detected properly. If you want, you can adjust the version name in the appropriate box.

The last tab to look at is the Kits tab. It allows you to pair a compiler with the Qt version to be used for compilation. In addition to this, for embedded and mobile platforms, you can specify a device to deploy to and a sysroot directory containing all the files needed to build the software for the specified embedded platform. Check that the name of each kit is descriptive enough so that you will be able to select the correct kit (or kits) for each of your applications. If needed, adjust the names of the kits.