Install Qt Creator on Linux
Below are basic instructions for installing on Linux that may work for your system, however, we are unable to provide further Linux support. If you are unable to get Qt Creator working on your Linux system, please consider using another computer or working on a campus cluster computer.
1) Install prerequisites
If you're running Ubuntu, Debian, Mint, or any other Debian derivative, you can install the needed components using the apt
package manager. Issue the following commands below in your shell.
The first command ensures your package manager is up-to-date:
sudo apt-get update && sudo apt-get upgrade
This command installs the tools and libraries needed for Qt (be sure to copy/paste the entire line, it is long!)
sudo apt-get -y install build-essential openssl libssl-dev libssl1.0 libgl1-mesa-dev libqt5x11extras5
If you're running some other variant of Linux, figure out a way to install the tools make
, g++
, and gdb
.
(For example, on Fedora / Red Hat systems, you may be able to use the yum
package manager.)
2) Download installer
The Qt Creator official download site is https://www.qt.io/download-qt-installer. When you go to this site, it should detect that your computer is running Linux and recommend the installer "Qt Online Installer for Linux". Click the green "Download" button to download the installer.
3) Run installer
The downloaded installer is named something like qt-unified-linux-x64-version-online.run
and is likely located in your ~/Downloads
directory. Use chmod +x qt*.run
to make the file executable, then run it by typing ./qt*.run
.
The graphical installer launches and walks you through a set of steps. For most steps, you can use the default settings and simply click "Next" or "Agree" to move on, with the following exceptions:
- At the Qt Account step, you will have to create your own Qt Account.
- At the Select Components step:
- Select the highest-numbered Qt version. For Summer 2021, the version number must be at least Qt 5.15.0.Do not select any version labeled "Preview" or "Alpha" or "Beta".
- IMPORTANT: You must also select the Desktop gcc kit component. Expand the "Qt" triangle, then expand the triangle with Qt version number, then click the checkbox labeled "Desktop gcc". See the screenshot below.
(The screenshot has part of the version number scribbled out since the versions change so frequently; it is just shown as a general example of what the UI will look like.)
3) Install CS106 specific components
After installing Qt, you must install the CS106-specific components and do a complete build and run cycle to confirm all is working properly.
Download CS106 project and extract
- Download this archive file: 📦 CS106.zip
- Un-zip the download contents (on a Windows computer, click "Extract all") to a location of your choice. You should have a folder named
CS106
with several files and folders inside.
Open and configure CS106 project
A Qt Creator project includes a file named with a .pro
extension. Double-clicking the .pro
file opens the project in Qt Creator.
-
Find the
CS106.pro
file and open it now. - When opening a project for the first time, Qt Creator brings up a "Configure Project" panel for you to select the appropriate build kit (see screenshot below). The default kit should already be selected; it will match the component you selected when installing Qt Creator. Accept the default by clicking the "Configure Project" button.
- If no kits are shown as available, review the Qt install instructions. You can repeat the steps to re-install if you missed selecting the required components.
Build the program
C++ code must be compiled or built before it is run; this means converting the source code into executable binary code.
- Click the Build icon in the lower-left of the Qt Creator window.
- Watch the build progress meter in the lower-right. The first time you build a project, it can take a minute or more to compile the library code. When the bar turns green, it indicates the program successfully built.
Run the program
Now that the program is built, you are ready to run it.
- Click the Play/Run icon in lower-left of window.
-
As shown in the screenshot below, the welcome program prints a message to the console window and draws the Stanford logo on graphics window.
✔️ Congratulations, your installation is good to go! You may now discard the CS106 project, you will not need it again.
5) Configure settings (optional)
For a better experience, we suggest changing some of the default settings, see our recommended configuration settings.