Qt Creator Manual | Specifying Run Settings

Qt Creator Manual 4.3.0

Specifying Build Settings ◦ Specifying Editor Settings

# Specifying Run Settings

Qt Creator automatically creates run configurations for your project. To view and modify the settings, select Projects > Build & Run > Run.

The settings to specify depend on the type of the project and on the kit that you build and run the project with.

Click Add to add run settings for a project and Remove to remove the current settings.

The run configurations for qmake projects derive their executable from the parsed .pro files. For more information on how the commands are constructed, see Starting External Processes.

Qt Creator automatically adds run configurations for all targets specified in the CMake project file, `CMakeLists.txt`.

### Creating Run Configurations for Subprojects

To prevent Qt Creator from automatically creating run configurations for SUBDIRS projects, specify the following variable in the .pro file of the SUBDIRS project: `CONFIG += qtc_runnable`.

Qt Creator creates run configurations only for subprojects that also have `CONFIG += qtc_runnable` set in their .pro files.

### Specifying Run Settings for Desktop Device Types

You can specify command line arguments to be passed to the executable and the working directory to use. The working directory defaults to the directory of the build result.

For console applications, check the Run in Terminal check box. If you need to run with special environment variables set up, you also do it in the run configuration settings.

When building an application, Qt Creator creates a list of directories where the linker will look for libraries that were built as part of the project. To search those directories for libraries when starting an application, select the Add build library search path check box. The linked directories are made visible to the executable that Qt Creator is attempting to run. This option is enabled by default, and you should disable it only if you use deployment steps.

The Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug) option (only available on macOS) enables you to debug (for example, step into) linked frameworks, such as the Qt framework itself. You do not need this option for debugging your application code.

You can also create custom executable run configurations where you can set the executable to be run. For more information, see Specifying a Custom Executable to Run.

### Specifying Valgrind Settings

Qt Creator integrates Valgrind code analysis tools for detecting memory leaks and profiling function execution. You can configure the tools according to your needs.

You can specify Valgrind settings either globally for all projects or separately for each project.

To specify Valgrind settings for the current project:

1. In the Valgrind Settings section, select Custom.
2. Specify Valgrind settings for the project.

For more information about the settings, see:

- Selecting Profiling Options
- Selecting Options for Memory Analysis

Click Restore Global to revert to the global settings.

To specify global Valgrind settings, select Tools > Options > Analyzer.

### Specifying Debugger Settings

To select the languages to debug, select the Enable C++ and Enable QML check boxes.

Note: Opening a socket at a well-known port presents a security risk. Anyone on the Internet could connect to the application that you are debugging and execute any JavaScript functions. Therefore, you must make sure that the port is properly protected by a firewall.

For more information about debugging, see Debugging.

### Specifying Run Settings for Linux-Based Devices

To run and debug an application on a Linux-based device, you must create connections from the development host to the device and add the device configurations to kits. Click Manage Kits to add devices to kits. For more information, see Connecting Embedded Linux Devices.

When you run the application, Qt Creator copies the files to the connected device.

The run settings display the path to the executable file on the development host and on the device. To specify that another application launches your application, for example, enter the command in the Alternate executable on device field and select the Use this command instead check box.

You can specify command line arguments to pass to your application in the Arguments field.

### Specifying Run Settings for QNX Devices

To run and debug an application on a QNX device, you must create connections from the development PC to the device. Click Manage device configurations to create a connection. For more information, see Connecting QNX Devices.

Specifying run settings for QNX Neutrino devices is very similar to Specifying Run Settings for Linux-Based Devices.

### Specifying Run Settings for Embedded Devices

To run and debug an application on an embedded device (commercial only), you must create connections from the development host to the device and add the device configurations to kits. Select Manage Kits to add devices to kits. For more information, see the Installation Guide in the Qt for Device Creation documentation.

When you run the application, Qt Creator copies the files to the connected device.

The run settings display the path to the executable file on the development host and on the device.

To execute custom commands, select Add Deploy Step > Custom Remote Command (via adb shell) and enter the command to execute.

## Selecting the Run Environment

Qt Creator automatically selects the environment used for running the application based on the device type. You can edit the environment or select another environment in the Run Environment section.

You can edit existing environment variables or add, reset and unset new variables.

When running on the desktop, the Build Environment is used by default, but you can also use the System Environment without the additions made to the build environment. For more information, see Build Environment.

To run in a clean system environment, select Clean Environment.

When running on a mobile device connected to the development host, Qt Creator fetches information about the Device Environment from the device. Usually, it does not make sense to edit the device environment.

To modify the environment variable values for the run environment, select Batch Edit. For more information, see Batch Editing.

## Specifying a Custom Executable to Run

If you use CMake or the generic project type in Qt Creator, or want to run a custom desktop executable, create a Custom Executable run configuration for your project. For example, when working on a library, you can run a test application that links against the library.

Specify the executable to run, command line arguments, working directory, and environment variables to use.

## Specifying Run Settings for Qt Quick UI Projects

You can specify run settings for kits with Desktop device type:

- In the Arguments field, you can specify command line arguments to be passed to the executable.
- In the Main QML file, select the file that Qt QML Viewer will be started with.

Specifying Build Settings ◦ Specifying Editor Settings