83

Is there a way to send command line arguments to a program being debugged in QtCreator?

paul simmons
  • 5,568
  • 13
  • 51
  • 78

4 Answers4

102

Go in the "Project" part on the left of QtCreator and then in the "Run Settings" tab. There is a Arguments line edit where you can put all you need to pass to your app when launching it.

For Qt Creator from Qt 5.6 Go in the "Projects part on the left and then in the "Build & Run" tab. Here you have a "Command line arguments" edit where you can put all parameters you want to pass to your app.

Patrice Bernassola
  • 14,136
  • 6
  • 46
  • 59
  • 1
    if you have a ';' in one of your params, put a '\' before it. eg. `--docroot=static-content;/resources --deploy-path=/` becomes `--docroot=static-content\;/resources --deploy-path=/` in qtcreator run settings page .. otherwise it'll stop reading at ';' and ignore all the rest of the command line. – matiu Sep 24 '11 at 04:36
  • This does not match QtCreator version 3.3.2 There is no "Run Settings" or am I missing something? – Harvey Apr 04 '15 at 17:24
  • Yep. There's two buttons in a dark-grey box, one called **Build** and one called **Run**. You need to click the **Run** button and it will switch to it for you. – kayleeFrye_onDeck Apr 06 '16 at 00:10
  • This is no longer the correct answer. Deprecate the green checkmark and note the fact. – user3673 Feb 13 '17 at 17:48
  • Instead of downvoting a correct answer when question was asked (7 years ago), why not only update the answer by replacing "Run settings" by "Build and Run"? – Patrice Bernassola Feb 14 '17 at 10:43
33

As the accepted answer is outdated, I post this picture which answers the question for a newer version of QtCreator:

enter image description here

Minimus Heximus
  • 2,683
  • 3
  • 25
  • 50
8

For Qt Creator 3.3.2, to set the working directory and command line arguments:

Projects (far left of Qt Creator)
- Build & Run (tab)
-- Run (sub tab) - brings up "Run Settings"
--- Arguments: ...
--- Working directory: ...

Harvey
  • 2,062
  • 2
  • 21
  • 38
3

As per the image below, Build & Run has an input for command line arguments (in the screen shot it is highlighted with a blue border as it has the focus) :-

enter image description here

Qt Creator with Qt version 5.6.1

MikeT
  • 51,415
  • 16
  • 49
  • 68
Nitish Kanade
  • 201
  • 2
  • 4