Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt creator: howto pass command line arguments to the program you are writing?
Forum Updated to NodeBB v4.3 + New Features

Qt creator: howto pass command line arguments to the program you are writing?

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 18.8k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cdwijs
    wrote on 8 Sept 2016, 13:19 last edited by
    #1

    Hi All,
    I am writing a console Qt application that accepts command-line options. Therefore I'm using QCommandLineParser. I write the program in Qt creator, and use the F5 key to start debugging. Now my program is started in the debugger, but this way I'm not able to set any command line options, and I cannot see if my program handles them correctly.
    Second option is to build the program in Qt creator, then open cmd.exe, goto the build directory, and then run the program from there. This way I can set command line options for my application, but then I can not debug the program.
    Is there a way to tell QtCreator to give my program a set of command line options?
    Is there a way to set a breakpoint my program, so I can start it with command line options from cmd.exe, and then attach with the debugger in QtCreator, and then step trough the program?
    My versions:
    Windows 7 enterprise SP1 64 bit
    Qt Creator 3.6.0 Based on Qt 5.5.1 (MSVC 2013, 32 bit)
    QT5.5, mingw492_32
    Cheers,
    Cedric

    1 Reply Last reply
    1
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 8 Sept 2016, 13:25 last edited by
      #2

      Hi and welcome
      I think you can use this

      1 Reply Last reply
      5
      • C Offline
        C Offline
        cdwijs
        wrote on 8 Sept 2016, 13:47 last edited by
        #3

        Thank you.
        I feel a bit stupid for not finding that myself, but I'm very glad you answered me this fast.
        Cheers,
        Cedric

        M 1 Reply Last reply 8 Sept 2016, 13:49
        1
        • C cdwijs
          8 Sept 2016, 13:47

          Thank you.
          I feel a bit stupid for not finding that myself, but I'm very glad you answered me this fast.
          Cheers,
          Cedric

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 8 Sept 2016, 13:49 last edited by mrjj 9 Aug 2016, 13:50
          #4

          @cdwijs
          oh no worries you provided good info on platform and versions so
          +1 for that anyways :)

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jheyob
            wrote on 26 Sept 2017, 16:18 last edited by
            #5

            Just to be sure, my question is for QtCreator 4.2.
            This topic "Qt creator: how to pass command line arguments to the program you are writing" is marked as SOLVED, but the solution is not available to view or read.
            Can you please re-post the solution?
            Thanks,
            Jeff

            M 1 Reply Last reply 26 Sept 2017, 16:33
            0
            • J jheyob
              26 Sept 2017, 16:18

              Just to be sure, my question is for QtCreator 4.2.
              This topic "Qt creator: how to pass command line arguments to the program you are writing" is marked as SOLVED, but the solution is not available to view or read.
              Can you please re-post the solution?
              Thanks,
              Jeff

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 26 Sept 2017, 16:33 last edited by
              #6

              @jheyob

              Hi and welcome

              If you mean where to write the command line arguments , the image i posted higher up
              shows where to find it.

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jheyob
                wrote on 26 Sept 2017, 16:49 last edited by
                #7

                I cannot see a solution image. Apparently, my secure work environment is blocking some image types again on the non-secure network. Normally, I can see PNG and JPG.
                I will check it again from home.
                Thanks.

                M 1 Reply Last reply 26 Sept 2017, 16:52
                0
                • J jheyob
                  26 Sept 2017, 16:49

                  I cannot see a solution image. Apparently, my secure work environment is blocking some image types again on the non-secure network. Normally, I can see PNG and JPG.
                  I will check it again from home.
                  Thanks.

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 26 Sept 2017, 16:52 last edited by
                  #8

                  @jheyob
                  oh that was new :)
                  its
                  Projects (left side, under debug)
                  Then Run Settings
                  then there is an edit "command line arguments"

                  1 Reply Last reply
                  2
                  • J Offline
                    J Offline
                    jheyob
                    wrote on 27 Sept 2017, 13:43 last edited by
                    #9

                    Yes, found it. Problem solved.
                    Thanks.

                    1 Reply Last reply
                    1

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved