Clion Download Mac

Qt is a cross-platform C++ framework for creating GUI applications. Qt uses its own build system, qmake, and also supports building with CMake starting from the version Qt4.

Clion Download Mac

Mar 08, 2021 Rust is supported in CLion via the IntelliJ Rust plugin, compatible with all IntelliJ-based IDEs. The plugin provides Rust language engine with a set of code insight features, Cargo support, and debugger functionality (in CLion and IntelliJ IDEA Ultimate). The Rust plugin is an open-source GitHub project. Restart your IDE upon installation; Install Now. Manual Installation. In the File menu choose Settings. Tip: If you are using MacOS, in the CLion menu choose. To install JetBrains Clion, run the following command from the command line or from PowerShell: To upgrade JetBrains Clion, run the following command from the command line or from PowerShell: To uninstall JetBrains Clion, run the following command from the command line or from PowerShell:. Apr 16, 2021 In CLion, go to Settings (Ctrl+Alt+S), navigate to Build, Execution, Deployment Toolchain and select the toolchain that matches your Qt installation. If you have several Qt installations, make sure to select the same toolchain as the one you specified in CMAKEPREFIXPATH. How to Install and Setup CLion For C/C Programming. Several C/C integrated development environments, such as CLion, VS Code, Codeblocks, etc, are available on the internet. But, if you are someone who loves to use JetBrains products, then CLion is for you. It is an IDE developed by JetBrains to run C/C programs.

Download CLion EAP 1.0 for Mac from our software library for free. This Mac application was originally created by JetBrains. The size of the latest downloadable setup file is 107 MB. Commonly, this application's installer has the following filename: clion-140.1221.2.dmg. The most popular version of CLion EAP for Mac is 1.0. Trusted Mac download CLion 2021.2.3. Virus-free and 100% clean download. Get CLion alternative downloads.

A pure Qmake project can't be imported in CLion directly. However, when converted into CMake, it can be opened and managed as a regular CMake application. You can also create a CMake-based Qt project in CLion using the New Project wizard.

Another option to open a Qt project is to use a compilation database. You can generate compile_commands.json for your qmake project with the help of scan-build or via the Build Generate Compilation Database action in Qt Creator, then open this file as a project in CLion and add custom build targets and custom Run/Debug configurations for it.

CMake-based Qt projects

For CMake version 3.0 and newer, Qt ships the modules that let CMake find and use Qt4 and Qt5 libraries. Take the following steps to configure CMakeLists.txt for your Qt project.

CMakeLists.txt for a Qt project

  1. Add the find_package command to locate the required libraries and header files. For example:

    Then, use target_link_libraries to make your target dependent on these libraries and headers:

  2. For find_package to perform successfully, CMake should be instructed on where to find the Qt installation.

    One of the ways to do this is by setting the CMAKE_PREFIX_PATH variable. You can either pass it via -D in the CMake settings dialog or via the set command before find_package.

    For example, in the case of MinGW on Windows:

    set(CMAKE_PREFIX_PATH 'C:QtQt5.')
    set(CMAKE_PREFIX_PATH 'C:QtQt5.')
  3. If your project uses MOC, UIC, or RCC, add the following lines to enable automatic invocation of the corresponding compilers:

  4. List all the .ui and .qrc files in the add_executable() command along with your .cpp sources:

    add_executable( helloworld main.cpp mainwindow.cpp application.qrc)

Below you can find the full CMakeLists.txt script for a simple 'Hello, world' application:

cmake_minimum_required(VERSION 3.10)project(Qt-CMake-HelloWorld)set(CMAKE_CXX_STANDARD 17)set(CMAKE_INCLUDE_CURRENT_DIR ON)set(CMAKE_PREFIX_PATH 'C:QtQt5.')find_package(Qt5Widgets REQUIRED)set(CMAKE_AUTOMOC ON)set(CMAKE_AUTOUIC ON)set(CMAKE_AUTORCC ON)add_executable(helloworld main.cpp mainwindow.cpp application.qrc)target_link_libraries(helloworld Qt5::Widgets)

Setting up a Qt project in CLion

Toolchains on Windows

  1. When installing Qt on Windows, pick the distributive that matches the environment you are using in CLion, MinGW or MSVC.

    For MinGW, both the version and the bitness (32-bit MinGW or MinGW-w64) should match with your toolchain setup.

  2. In CLion, go to Settings (Ctrl+Alt+S ), navigate to Build, Execution, Deployment Toolchain and select the toolchain that matches your Qt installation.

    If you have several Qt installations, make sure to select the same toolchain as the one you specified in CMAKE_PREFIX_PATH.

    As an example, in the case of MinGW:

For details on Windows toolchains, take a look at the MinGW or MSVC section of our Windows Tutorial.

CMake settings

  • Qt projects are handled as regular CMake projects in CLion, so you can configure CMake settings in Settings/Preferences Build, Execution, Deployment CMake as necessary.

    For example, you can create different CMake profiles with different build types and set up CMake generators of your choice.

    In this dialog, you can also specify CMake options, such as CMAKE_PREFIX_PATH instead of setting them in CMakeLists.txt:

Debugger renderers

Clion Download

You can use Qt type renderers, which are usually shipped with Qt tools, for your project in CLion. However, for now, you need to set them manually either using the .gdbinit/ .lldbinit scripts or, in the case of MSVC, via native visualizers.

  • Windows MSVC

    CLion’s debugger for the MSVC toolchain can employ native visualizers if you have them in your project. Make sure to set the Enable NatVis renderers for LLDB option in Settings Build, Execution, Deployment Debugger Data Views C/C++.

    For example, copy qt5.natvis under your project root, and CLion will automatically detect and use it for rendering.

  • Windows MinGW / macOS / Linux

    For non-MSVC toolchains, a solution would be to configure the Qt renderers via .gdbinit/.lldbinit. These scripts are loaded on every invocation of GDB or LLDB, respectively.

    1. You can try KDevelop formatters for GDB, KDevelop formatters for LLDB, Lekensteyn's qt5printers (GDB), or create your own pretty-printers.

      To create custom pretty printers, follow the official instructions for LLDB or GDB. You can take the pretty-printers for Rust implemented in the IntelliJ Rust plugin as a reference.

    2. Point the debugger to your renderers via .gdbinit/ .lldbinit. Find an example in this github repo.

    3. Place the .gdbinit/ .lldbinit files under the project root and allow them in your home directory as described here.

Editing UI files in Qt Designer

By default, CLion opens .ui files in the editor. You can change this behavior in order to edit .ui files right in Qt Designer.

  1. Go to Settings / Preferences Editor File Types, select Qt UI Designer Form from the Recognized File Types list, and delete the associated file extension.

  2. Next time you click a .ui file for opening, set the Open in associated application checkbox, and the files of this type will always open in Qt Designer.

Creating a CMake-based Qt project

CLion provides two project templates for Qt: Qt Console Executable and Qt Widgets Executable.

Call File New Project and select the project type in the left-hand pane. Specify the location, language standard, and Qt version. You can also provide the path to be used in CMAKE_PREFIX_PATH. Click Create when ready.

CLion will generate a ready-to-go stub project with CMakeLists.txt filled in automatically, including the CMAKE_PREFIX_PATH variable:

Qt UI class templates

You can quickly create a Qt class with the corresponding .ui, .cpp, and .h files.

  1. In the Project view, select New from the context menu or press Alt+Insert. Choose Qt UI Class:

  2. In the dialog that opens, fill in the class name and configure the following settings:

    • Filename base- specify the name for the .ui/ .cpp/ .h files to be generated.

    • Parent class- select QWidget, QMainWindow, QDialog, or a custom parent class.

    • Namespace- specify the enclosing namespace if required.

    • Add to targets- set this checkbox to automatically add the new files to the list of sources for the selected target(s).

  3. CLion will generate the .ui, .cpp, and .h files following the templates defined in Settings / Preferences Editor File and Code Templates: Qt Designer Form, Qt Class, and Qt Class Header, respectively. If required, you can adjust these templates for your needs.

Qt-specific code insight

  • CLion provides code completion for Qt signals and slots, filtering the suggestion list to show only the corresponding members:

    Completion works for the SIGNAL() and SLOT() macros as well:

  • CLion's auto-import supports Qt-style header files, offering the shortest possible #include:

  • Also, CLion integrates with clazy, a Qt-oriented static code analyzer. You can configure the severity and level of clazy checks in Settings/Preferences Editor Inspections C/C++ General Clazy:

QtCreator keymap

CLion bundles the QtCreator keymap. You can switch to it in Settings / Preferences Keymap or by calling View Quick Switch Scheme from the main menu (Ctrl+` ):

Current limitations

Two umbrella tickets in CLion tracker: Qt project support (CPP-318) and Qt issues (CPP-1897).

  • Some of the CLion's code generation features may not work for Qt macros, such as Q_PROPERTY, Q_SIGNAL, Q_SLOT, and others.

  • Although QML is not supported in CLion out of the box (see the feature request ), you can try the QML Support plugin.


If you get the Process finished with exit code -1073741515 (0xC0000135) error message when running on MinGW, the issue might relate to Qt deployment on Windows: dynamic libraries and Qt plugins must be found from the directory of the running binary. Try one of the workarounds described below.

Clion Installation On Mac

Option 1

  • Add the path to bin under the MinGW directory in the Qt installation (for example, C:Qt5.15.1mingw81_64bin) to the system PATH or in the Environment variables field of the configuration settings.

    If this doesn't solve the issue for your project, try Option 2.

Option 2

  1. Copy the .dll -s located in bin under the MinGW directory in the Qt installation to your project’s generation folder, which is cmake-build-debug or cmake-build-release by default.

    The libraries you will most likely need are libstdc++-6.dll, Qt5Widgets.dll, Qt5Gui.dll, and Qt5Core.dll, but your setup might require other libraries as well.

  2. In the settings of the configuration you use for running, set the QT_QPA_PLATFORM_PLUGIN_PATH environment variable to pluginsplatforms under the MinGW directory:

    Another option is to copy the contents of pluginsplatforms to cmake-build-debug(release)/platforms (make sure to create the platforms directory).

    Refer to the Qt Plugins documentation for more details.

Tips & Tricks

Wondering how to add a package to your C++ project? In this guest blog post Javier G. Sogo from JFrog shares how to start with Conan package manager in CLion.

Javier G. Sogo
Software Engineer at JFrog
After several years of C++ development, I moved to Python to learn the best practices and tools. Now I’m back building Conan, the C/C++ package manager.

Writing a C++ project from scratch is always a delightful challenge. Starting from a blank page writing your code and creating your functionalities, all the way through to building on top of solid and high-performance libraries… but wait! Sometimes it’s not easy to get those libraries available for your project to compile and link, and possibly you are not experienced in that build system or the library may require some patches to be built for your platform.
The lack of a package manager in the C++ world has slowed many projects down, requiring dedicated efforts to handling external libraries or rewriting functionalities to avoid using third parties.
Conan is an open source, decentralized package manager that simplifies the process of integrating and reusing C and C++ libraries and packages. It automatically manages and reuses binaries for any possible configuration, increasing development speed. Conan is also able to build and cross-build packages from sources, it integrates with any build system, with very high flexibility and customization capabilities.
In this blog post, we will show how to use Conan in your CLion workspace to get your preferred libraries ready to use in your project. We will use the Conan-CLion plugin to integrate both applications smoothly, for example, by building an MD5 hasher using an already available implementation from the Poco libraries.

Installing all the parts

1. Conan-CLion Plugin

To follow along with this example, you’ll need to install the Conan by JFrog plugin from the JetBrains marketplace. It can be easily installed using the Plugins section in the Preferences/Settings window, or from the welcome screen using the Configure>Plugins option.

After restarting CLion a new “Conan” tool window will appear at the bottom of the IDE, which is ready for you to use.

2. Conan Client

Next, you’ll need to install Conan. Conan is a python application, you can install it using pip (pip install conan) inside a Python virtual environment or system-wide, or you can download a standalone application and unpack it into your system, choose the way that best fits your needs from the download page.
We highly recommend that you read the Conan documentation; although the default configuration is enough for this example, it is important for you to know about many other important features that are not covered in this article. Including, the distributed nature of Conan that allows mixing different origins for your libraries, JFrog Artifactory integrations, workspaces, etc. These features will help you in developing high-quality software.

3. Conan Plugin Configuration

There are a couple of configuration points we need to address before running our example, these configurations only need to be done once for all your projects. First of all, you will need to provide the path to the Conan executable you want to use in the Preferences window (leave it empty to use Conan from the PATH).

Second, we need to define the correspondence between CLion CMake profiles and Conan profiles. CLion profiles are a handy way to create different configurations to build your project, the same as Conan profiles, that’s why both should match.

A Conan profile is a file where the user defines a set of settings, options, environment variables, and build requires, that can be reused to build any package. These files can be handled individually using `conan profile` commands or, if you are working with other people, you will probably want to maintain a shared configuration with your colleagues using `conan config install` commands. Create as many profiles as you want using the command line or copy an URL with your shared Conan configuration into the plugin settings. For more information related to this core feature of Conan, the documentation about using profiles is a good starting point.
Once your profiles are ready, match them with the CLion ones using the button, a window will pop up for you to make these assignments.

Clion Installation Options

Creating the C++ project

After the configuration is complete, we can leap into C++. The following example demonstrates the MD5 hashing utility in the Poco library, a few lines of code should be enough to get us started:
If we try to compile this project using CLion it will fail, because the Poco libraries are missing. This is where our package manager comes into action.

Getting your dependencies with Conan

Conan uses a separated file to store information related to a project. This can either be a plain `conanfile.txt` file, or a python `` file that handles more complex logic regarding your dependencies. The Conan plugin can work with both of these file types.
For this example we only need a couple of lines in a `conanfile.txt` that you should add to your repository:


These lines notify Conan that our project requires the Poco library, and provide the version and origin for it. Conan will look in the remotes and retrieve the recipe for Poco from there, it will also grab the binaries if they’re available for your configuration and, if not, it will trigger a compilation from sources. All of this will be done using the Conan install button, , that can be found in the Conan tool window.

As you can see, Conan not only installed the Poco libraries, but also OpenSSL and ZLib too. This is because they are transitive dependencies of Poco. If binaries matching your configuration are available in the remote, Conan will just download them, otherwise, Conan will compile these packages from sources no matter if they use CMake or other build systems (OpenSSL uses Makefiles).


Clion Download Mac Software

Conan will create a file for each of the generators listed here, as CLion uses CMake we need that generator. These files contain all the information of the requirements, including: paths to includes, libraries or resources, and compile flags. Basically, everything that needs to be consumed by your project. You only need to include this file into your build system, there is no need to change anything else, and you’re ready to go.
Modify your `CMakeLists.txt` to include this automatically generated file, named `conanbuildinfo.cmake`:

Compile again and run your project. Conan will take care of your dependencies, by locating and downloading (or compiling) them, making them available for your project. If you feel that this implementation requires modifying your project, you can try other CMake related generators available in Conan, such as `cmake_find_package` or `cmake_paths`. Additional information on how to activate these generators can be found in the Conan documentation.


Alongside CMake and CLion, Conan has become one of the big C’s for the C++ language. Having a package manager encourages the community to share their libraries and build functionalities on top of existing ones, modernizing the C++ ecosystem towards a more mature and useful one. It also allows companies to have a professional tool to build all their internal libraries and third-parties using the same process, preserving consistency and reproducibility of their builds, and keeping their developers focused on their job.
The plugin in its first version implements just some basic functionalities of Conan, we highly recommend you to use it in your projects, but also to explore all the functionalities that Conan provides. We’re always happy to receive feedback related to both the CLion plugin and Conan in general.

Happy Coding!

Download/Install/Test the CLion IDE

CLion is an Integrated Development Environment (IDE) that uses the Cygwin toolset to develop/test C++ programs. It occupies about 920 MB on disk.

Before installing CLion in this handout, you should have already downloaded and installed the Cygwin toolset (if you haven't, go back and do so).

You may want to print these instructions before proceeding, so that you can refer to them while downloading and installing CLion. Or, just keep this document in your browser. You should read each step completely, before performing the action that it describes.

Download Clion Windows

This document shows the installation of CLion version 2019.2; I installed this version during Summer 2019 (although the Registration part, which I couldn't repeat, was from 2016). You should install the latest version to be compatible with how CLion is used in this document.

JetBrain's CLion: Version 2019.2

Section 0) Registering For a Free Copy of CLion

In this section you will register for a free copy of CLion online.

You will ultimately need to provide a copy of your student ID or an unofficial transcript by attaching it when prompted for an OFFICIAL DOCUMENT: you need to provide some 'proof' that you are currently enrolled at UCI. My students have been using CLion for a few years and I have yet to hear of any unresolved problems involving proving they are UCI students.

  1. ClickStudent License.

    When run, the following JetBrains Products for Learning screen should appear. Fill it in as shown, but with your Name and Email address (not mine).

    Click the APPLY FOR FREE PRODUCTS button.

    The following screen may appear.

    If it appears, click the checkbox.

    A Thank You! screen will appear, indicating that Jet Brains is sending you a Confirm Request email.

  2. You should receive an email from JetBrains (likely within 5-10 minues) containing the following text:

    You've received this email because your email address was
    used for registering/updating a JetBrains Educational Pack.

    Please follow this link to confirm your intention:

    Confirm Request

    Yours truly,
    JetBrains Team
    The Drive to Develop

  3. Click the Confirm Request link. A Congrats! You've been approved! screen will appear, indicating that Jet Brains is sending you an Activate Educational License email.
  4. You should receive an email from JetBrains (likely within 5-10 minues) containing the following text:
    Dear <Your first name>

    Congratulations! Your JetBrains Student License is confirmed.

    To activate your license, use the following link:
    Activate Educational License

    After accepting the License Agreement, you will be asked
    to sign up for a Student JetBrains Account. You will use
    this account to sign in to JetBrains product(s) whenever
    you use them.

    Happy coding!

    Yours truly,
    JetBrains Sales Team

  5. Click the Activate Educational License link. A TOOLBOX SUBSCRIPTION LICENSE AGREEMENT FOR EDUCATION screen will appear.
  6. Click the I Accept button.

    The following JetBrains Products for Learning screen should appear.

  7. Enter your User Name and Password (and Repeat Password), click the I have read... checkbox, and click the Submit button. Write this information in a location for future reference.

    The following JetBrains Product Pack for Students screen should appear (I have blacked-out my License ID).

    Write down the License ID for future reference.

  8. Note that anyone (even without a university email address) can download aFree 30 Day Trial version of CLion.

Section 1) Downloading/Installing CLion

In this section you will download and begin installing CLion for use with the Cygwin toolset.

Clion Download Mac Torrent

  1. ClickCLion.

    When run, the following Download CLion screen should appear (ensure the Oval surrounds the operating system you are on).

    Click the Download button to download the executable file named CLion-2019.2.exe, which when run will install the 64-bit version of CLion. It may display another screen asking you to enter information; you can enter information on this screen or ignore it. Its icon will appear on your screen as follows.

    Save this file for future use, in case you need to reinstall it: on my system I stored this file as C:ZDataInstalled SoftwareCLion-2019.2.exe

  2. Double-click the CLion-2019.2.exe file.

    When run, a User Account Control pop-up window may appear on your screen. I could not capture its image, but it asks, Do you want to allow this app to make changes to your device

  3. Click the Yes button on this window.

    If you have no previous version of CLion installed, the following CLion Setup pop-up window should appear on your screen.

    If you have any previous versions of CLion installed, the following CLion Setup pop-up window should appear on your screen. Check the checkboxes for the versions you want to uninstall, and check the checkbox labelled Uninstall silently.

  4. Click the Next> button on whichever window appeared.

    The following CLion Setup: Choose Install Location pop-up window should appear on your screen.

    For simplicity and consistency, ensure the Destination Folder is C:Program FilesJetbrainsCLion 2019.2 (the default).

  5. Click the Next> button on this window.

    The following CLion Setup: Choose Installation Options pop-up window should appear on your screen.

    Check all checkboxes (the default is none are checked).

  6. Click the Next> button on this window.

    The following CLion Setup: Choose Start Menu Folder pop-up window should appear on your screen.

    For simplicity and consistency, ensure the textbox contains JetBrains (the default).

  7. Click the Install button on this window.

    The following CLion Setup: Installing progress pop-up window should appear on your screen.

    It might take (a few) minutes (depending on your connection speed) for CLion to be downloaded and installed. Eventually this window will be replaced by the following CLion Setup - Completing the CLion Setup Wizard window on your screen.

  8. Click the Finish button on this window (leaving unchecked the Run CLion checkbox).

    Find the JetBrains CLion 2019.2 shortcut icon on your desktop.

    If there none, create a shortcut icon (with this name, or just CLion) on your desktop to the file C:/Program Files/JetBrains/CLion 2019.2/bin/clion64.exe.

    You will double-click this icon to start CLion (see the next section).

    Note, when I downloaded CLion I did not need to reboot to complete the installation of CLion; certainly to be safe you can reboot your machine now.

Section 2) Initializing/Testing CLion with the Cygwin Toolset and Clang

In this section you will finish installing CLion and then create, build, and run a trivial CLion project/program (including editing it and seeing how syntax errors are reported). It will also discuss some useful features in the CLion IDE.

  1. Double-click the CLion shortcut icon created above.

    On my machine it takes about 15 seconds for the flash screen to appear, and another 5 seconds for the IDE to display.

    NOTE: The two icons below are from an older version of JetBrains, so the ones you see may differ.

    If you have no previous version of CLion installed, the following Complete Installation pop-up window should appear on your screen. Ensure that the I do not have... radio button is pressed.

    If you have a previous version of CLion installed, the following Complete Installation pop-up window should appear on your screen. Ensure the Previous version ... radio button is pressed. This configuration information was not removed as part of the uninstall.

  2. Click the OK button on whichever window appeared.

    The following CLion License Activation pop-up window may appear on your screen.

    If it appears, fill in your email and password (see step 6 from 'Section 0') and then click Activate.

  3. The following CLion User Agreement pop-up window should appear on your screen.
  4. Scroll throught and read this document :)
    Click the I confirm that I have read and accept the terms of this User Agreement box.
    Click the Continue button.

    The following Data Sharing pop-up window should appear on your screen.

  5. Click the Send Usage Statistics button.

    CLion loads and the following Welcome to CLion pop-up window should appear on your screen.

  6. Click the New Project text on this window.

    The following New Project pop-up window should appear on your screen.

    In the Location textbox, at the end of the path, replace untititled by trivialtest.

    In the Language Standard pull-down list, select C++11. When you create later projects, this will become the new default.

  7. Click the Create button on this window.

    If a Tip of the Day pop-up window appears, click its Close button; you can first check the box to not display such tips in the future.

    The IDE's pop-up window will appear. There will be some activity at the bottom (see picture below).

    This happens whenever a new project is loaded. Wait for it to finish all its tasks (a few minutes at most).

    At that time I saw a window insert (lower-right) that said

    I clicked Fix and saw a window that said

    I clicked Configure Automatically and saw a window that said

    The following CLion project window should appear on your screen I have resized it below).

    Note that the right pane lists the tabs CMakeLists.txt (which contains the project's make code; it should be familiar if you read the commandline document) and main.cpp (which is shown and contains a trivial C++ program). These tabs appear in the order shown (but you can re-order them by draging/dropping either); if you want more control over these tabs, you can select Window Editor Tabs Configure Editor tabs.. (first); there you can click the Sort tabs alphabetically or Open new tabs at the end boxes (second).

    If we right-click in the gray area between the Project and Editor panes, we can toggle Show Line Numbers and Show Indent Guides options.

    It useful to click the disclosure triangle to the left of trivialtest in the Project/left pane.

    Every project will contain a cmake-build-debug folder, which will ultimately contain the compiled code (executable) for the project. Later, we will see how to put data files into that folder; the executable uses that folder by default for reading/writing files. Students frequently forget to put their data folders here, causing them all sorts of confusion/delay when trying to read data files.

  8. Depress the File tab and select Settings as shown in the following illustraton.

    The following Settings window should appear on your screen.

  9. Disclose the Build, Execution, Deployment item, and select CMake.

    The following Settings window should appear on your screen (see below for the changes needed to show this exact screen).

    1. Check the Automaticall reload CMake project on editing
    2. Copy and paste the text
      -D CMAKE_CXX_COMPILER=/cygdrive/c/cygwin64/bin/clang++ -D CMAKE_C_COMPILER=/cygdrive/c/cygwin64/bin/clang
      into the CMake Options textbox. These CMake... switches tells CLion that we will be using the Clang C++/C compilers. Doing so never will be wrong, but it might be unnecessary if you have only one C++/C compiler on your system.

    Another way to fix this problem is to ensure the following lines start your CMakeLists.txt file (see part 10 below, which shows the last line).

    If you do have multiple compilers on your machine and forget to specify these CMake switches or CMakeLists.txt options (or enter the wrong information) you might encounter compliation problems. These error messages often contain the text multiple definition of ...

    You will setup all projects in the same way, so once you do a few, all the rest will be setup similarly. I recommend always doing these two operations once, for every new project.

  10. Click the OK button on this window.

    There will be some activity briefly at the bottom of the window: CLion is and updating the cmake-build-debug folder, which may take a few minutes.

    If you click (sometimes I needed to double-click) the appearing at the 2nd to bottom line of your window, the following CMake-Debug pane will appear at the bottom of CLion project window (it may appear automatically if there is a problem with your CMake file).

    The CMake Debug pane will shows CLion checking whether the CMake switches you entered are legal, You can scroll through the information in the CMake Debug pane (to see if there are any errors). By clicking this same icon, the CMake Debug pane will disappear. When you scroll through the CMake Debug pane it should show something very similar to the following.

    Especially important here is seeing ...cygwin64/bin/clang -- works and ...cygwin64/bin/clang++ -- works.

    If you want to examine the CMakeLists.txt file, click on it (the tab in the right pane). It will update the right pane to

    If you do this, click on main.cpp (in the right pane), to return to the C++ program.

  11. Click the (Build icon) on this window.

    The following CLion project window should appear on your screen.

    The results of the build appear in the Message Build pane, which is automatically displayed. This trivialtest C++ program has now been built (compiled and linked successfully); either could have dispayed errors in the Message Build pane. Such errors must be corrected before a program can be run.

  12. Click the (Run icon) on this window.

    The following CLion project window should appear on your screen.

    The results of running the program print in the Run trivialtest pane; when the program terminates, the Run trivialtest pane retains the history of the program's execution (input/output).

  13. To edit, rebuild, and rerun the program, change the output string to 'Goodbye, World!' and then click the (Run icon) again. CLion will try to both rebuild the project and rerun it. You will briefly see the Message Build pane as shown above; because building is successful this pane will disappear the code will be run, with the Run trivialtest pane replacing it.

    The following CLion project window should appear on your screen.

    The results of rerunning the program appear in the Run trivialtest pane.

  14. If we create a syntax error (remove the ; at the end of the cout line), CLion will soon highlight the character after endl (where the ; belongs), show a red squiggle under the error, put a purple bighlight over endl, and put a purple underline at the right end of that column, all in the main.cpp pane. If we hover over the red squiggle, the main.cpp pane shows

    If we hover over the purple line, the main.cpp pane shows

    CLion will also put a white ! surrounded by a red circle at the end of the top line in the main.cpp pane.

  15. If we try to rebuild (or run) this code (it will fail), click the (Build icon) or (Run icon) again.

    The following CLion project window should appear on your screen.

    The failed results of attempting to rebuild the program appear in the Messages Build pane (there is no Run trivialtest pane because the code failed to compile/link); here you can reposition the separation between the mail.cpp and Message Build panes to show the entire program and allow all the errors to appear.

We will now continue by learning how to download a CLion project and run it. During the quarter, you will be asked to do this for all programming assignments and many quizzes.

Section 3) Testing Downloadable CLion Projects with the Course Libraries

In this section you will learn more about CLion, by downloading the course libraries and then downloading/building/running a CLion project that contains various programs that use these libraries. We assume that you have CLion open and the trivialtest project in its window.

  1. Create a new shortcut named ClionProjects (to the folder C:UsersyournameClionProjects, which CLion should have created, now containing only the trivialtest folder) and place it on your desktop near the shortcut that you use to start CLion.
  2. Download and unzip the file libraries; Copy its three folders (courselib, gtestlib, and test_all_data_types) into the folder ClionProjects shortcuts; it should already contain the trivialtest folder, created by the operations above.

    Generally, whenever you download CLion projects, you will unzip them and then copy their folders into the folder that ClionProjects shortcuts.

  3. Click the File tab near the upper-left corner of the CLion window; then click the Open option in the pull-down menu.

    The following pop-up window should appear on your screen.

    You may need to scroll this window and disclose/undisclose various folders to make it appear as shown above. The Users folder should contain a folder with your name (Pattis for me); it should contain a folder with the ClionProjects folder; it should contain the three folders courselib, gtestlib, test_all_data_types, and trivialtest.

    Click on the test_all_data_types folder, so that it is highlighted as shown above.

  4. Click the OK button on this window.

    The following Open Project window should appear on your screen.

  5. Click the This Window button on this window. (clicking New Window creates a second project window, which is sometimes useful, but can also cause confusion; we are done with the trivialtest program in this document.)

    The following CLion project window should appear on your screen (after you disclose the test_all_data_types folder).

    Again, there will be some activity at the bottom (see picture below).

    This happens whenever a new project is loaded. Wait for it to finish all its tasks (a few minutes at most). Also, if a message about Defender is displayed, see Section 2, Part 7 of this document for information how to proceed.

  6. Scroll downward, select lines 30-35, and press ctrl-/ (this notation means, while holding the Ctrl key -it is like a shift key- press the / key), which uncomments the chosen lines (recall in C++ we use // double slashes for comments).

    The following CLion project window should appear on your screen.

    If you press ctrl-/ again, it will comment the lines; so this command really means toggle-comment on the selected lines. Before continuing ensure lines 30-35 are uncommented.

  7. Click the (Build icon) on this window The following CLion project window should appear on your screen. It shows the Message Build pane.

    Then click the (Run icon) on this window.

    The following CLion project window should appear on your screen.

    It shows the Run Build All pane.

      We could have bypassed the Build icon and just clicked the Run icon. In older versions of CLion, it wass useful (esepcially with programs that contain syntax errors) to Build and Run separately. If we clicked only Run, CLion would show the Message Build pane briefly; then immediately remove it -possibly losing useful information- and show the Run Build All pane. This version of CLion, seems to retain the Message Build pane, which we can access by pressing the 0: Messages button on the second to last line of the IDE.

    Experiment with this driver by entering commands (and their arguments, when prompted) to better understand the set data type. You can terminate this driver either by

    • entering the q command,
    • clicking the (Stop icon) on the left of the Run Build All pane

    After terminating the driver, click the Xto the right of the Run Build All pane to close/remove it.

    Note 1: if you try to close/remove the Run Build All pane before terminating the code runing in it, CLion will display the pop-up window

    Note 2: so long as you don't terminate the Run Build All pane, you can redisplay it by access by pressing the 4: Run button on the second to last line of the IDE.

    I suggest that you try terminating the driver with a q command; then, rerun the program and terminate it with the Stop icon. Also experiment with building/runing the code (possibly adding a syntax error by removing any of the semicolons in driver.cpp. Finally, experiment with clicking the 0: Messages, CMake and 4: Run buttons (you can try. Doing these tasks with this program now will make it easier for you to understand how to develop/debug your own code.

  8. We briefly examined the cmake-build-debug folder which appears in this project when test_all_date_types is disclosed.

    Now we will examine it in more detail, but via an Explorer window, not via CLion. Click on the ClionProjects shortcut to open an Explorer window, then double-click its test_all_data_types folder, and finally double-click its cmake-build-debug folder.

    The following Explorer window should appear on your screen.

    Whenever you create a project, a cmake-build-debug folder will appear in its project folder. We have built two projects in this handout: test_all_data_types and trivialtest; each has its own cmake-build-debug folder.

  9. Double-click the file test_all_data_types.exe in this folder to run this program in Windows, outside of CLion. The following MS-DOS window should appear on your screen.
    If an error pop-window like

    appears (many different messages may appear; sometimes a sequence of error message), you likely forgot to add C:cygwin64bin to the Sytsten variable PATH (illustrated below): see the Cygwin handout, step 15, for detailed instructions on how to fix this error.

    Experiment with this driver by entering commands (and their arguments, when prompted); it runs as it did in the CLion Run pane. Note that when you enter the q command the program terminates and the MS-DOS window immediately disappears (unlike the CLion Run pane).

    So, when a program we run under CLion terminates, its Run pane retains the input/output information (by cin/cout) after the run terminates, but when we run it directly in an MS-DOS window, the window disappears after the run terminates. For example, if you find the trivialtest.exe file and run it by double-clicking this file, its MS-DOS window will run and then immediately disappear.

    For a program that produces lots of output and terminates, we can always put an input statement at the end, so it doesn't terminate until the user enters something. It is sometimes faster to run the program in an MS-DOS window, rather than in CLion.

  10. Find the input files folder in the test_all_data_types folder and copy all of its .txt data files into the cmake-build-debug folder that contains the test_all_data_types.exe file. Copy these files using an Explorer window or the Project pane in the CLion window (after disclosing the cmake-build-debug and input files folders).

    The following Explorer window shows what the cmake-build-debug folder should contain.

    Then, run the program (either in the CLion Run pane or a MS-DOS window; try doing it from both places) and issue the lf command (load from file); when prompted for the file name, just press the Enter key to choose the default (loadset.txt).

    When running using the CLion Run pane, the following CLion project window should appear on your screen.

    IMPORTANT: If a program reads data files, the root folder for the specifying the files is the folder in which the .exe file appears. It is simplest to copy all the data files into this folder. An alternative would be to leave the files in the input files folder, copy the entire folder, and then refer to these file names like input filesloadset.txt.

  11. A typical project folder may have more than one .cpp file with a main function (as test_all_data_types has). Only one of these .cpp files can have its main function uncommented, otherwise its Build/Run will fail. When working on project, it is typical to
    1. Comment-out code in one .cpp file.
    2. Uncomment code in another .cpp file.
    3. Rebuild/Rerun the newly uncommented .cpp file.

    In the test_all_data_types project folder, the driver.cpp file has many main functions: we uncommented one (in step 6 above) to allow us to run the Set driver. If more than one main function is uncommented, attempting to build the code will result in the compiler specifying a redefinition of 'main' error, illustrated below when two main functions are uncommented.

    The test_all_data_types project folder also contains many .cpp files (their names all start with test) that each contain one main function (each is a Googletest for one data type). If more than one file contains a main function, attempting to build the code will result in the linker specifying a multiple definition of 'main' error.

    To switch this project from running the Set driver to the Set Googletest

    1. Comment-out lines 30-35 in the driver.cpp file: select them and type the ctrl-/ command to toggle the commenting on the selected lines (comment them). All lines in driver.cpp should be commented.
    2. Scroll down the Project Pane (on the left) and double-click the test_set.cpp file so that it appears as an editor tab.
    3. Type the ctrl-a command to select all the lines in this file.
    4. Type the ctrl-/ command to toggle the commenting on the selected lines (uncomment them).

    Click the (Run icon). When prompted enter the three lines of information shown and press Enter after each entry.

    The following CLion project window should appear on your screen.

    ICS-46 will provide Googletests like these for many programs, much as ICS-33 proivded batch self-check files: so you will automatically receive feedback on the correctness of your code.

We are now at the end of this handout. You will not need to repeat the first two sections during the course, but you will frequently download project folders and use them as demonstrated in Section 3. Please feel free to experiment with the CLion Integrated Development Environment and ask questions about it on Piazza. Any time that you spend experimenting with it now (before doing assignments), likely pay for itself many times over: no one wants to experiment with CLion when under deadline pressure for an assignment.