Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Almost there...where does the argument list go
Forum Updated to NodeBB v4.3 + New Features

Almost there...where does the argument list go

Scheduled Pinned Locked Moved Installation and Deployment
11 Posts 3 Posters 3.8k Views 1 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.
  • L Offline
    L Offline
    lycis
    wrote on last edited by
    #2

    Usually the arguments are passed to your application through various layers of your operation system. How do you access them in your software? What happens if you do something like that:

    @
    int main(int argc, char** argv)
    {
    qDebug() << argv[1] << endl; // might crash if there's no command line argument...
    ...
    }
    @

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on last edited by
      #3

      [Edit: this doesn't really apply to the problem. See below.]

      Shouldn't crash:

      @
      #include <QDebug>

      int main(int argc, char** argv)
      {
      qDebug() << "Application name: " << argv[0];
      if (argc) {
      for (int idx = 1; idx < argc; idx++)
      qDebug() << "Arg" << idx << "is" << argv[idx];
      } else {
      qDebug() << "No arguments given.";
      }
      return 0;
      }
      @
      // Brain to terminal. YMMV

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cloudbuster
        wrote on last edited by
        #4

        normally I execute the program using

        ./QtFigs4 figs.xml

        ...OR...
        ./QtFigs4 /home/qt4user/QtFigs4/figs.xml

        I just installed Qt sdk and to get going I opened

        the program by pointing to QtFigs4.pro

        Only problem now is the argument..a file name figs.xml

        Almost all SDKs allow entry of command line argument(s)

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mlong
          wrote on last edited by
          #5

          Ah.... misunderstood your question, I think!

          In Creator, go to the "Projects" icon on the left-hand panel, select "Run Settings" from the toolbar at the top of the screen. Then fill in the "Arguments:" field.

          Software Engineer
          My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            cloudbuster
            wrote on last edited by
            #6

            thanks! but projects yields topics
            targets
            editor settings
            code style settings
            dependencies

            I looked around for arguments but found nado

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mlong
              wrote on last edited by
              #7

              Ok, under Targets, there will be one or more platform descriptions (Desktop, Qt Simulator, Symbian Device, etc.) Each of those will have a (Build | Run) button group. Select "Run" on the platform you're interested in.

              (See "here":http://doc.qt.nokia.com/qtcreator-2.4/images/qtcreator-projectpane.png for illustration.)

              Description of run settings are "here.":http://doc.qt.nokia.com/qtcreator-2.4/creator-run-settings.html

              Software Engineer
              My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

              1 Reply Last reply
              0
              • C Offline
                C Offline
                cloudbuster
                wrote on last edited by
                #8

                thanks! It works except for a nasty little messagebox that says:

                "debugger settings point to a script file
                /home/qt4user/QtFigs4/figs.xml

                which is not accessible!

                I even did a chmod 777 on it just to try to remove the #$%^ message

                I'll have to track that down!"

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  cloudbuster
                  wrote on last edited by
                  #9

                  got rid of the nasty message box...things runs now

                  THANKS!

                  Next I'll try an eclipse project I know works.

                  It is a great little lottery program with a histogram of

                  value occurences . WOW it works and I don't have to open another window

                  for the ui

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    cloudbuster
                    wrote on last edited by
                    #10

                    EEEHA! two of my eclipse projects with UI are working.

                    Saw the build/run thing...but

                    but...nothing happened when I selected either build or run

                    The message box was not a crash exactly but a complaint!

                    Eclipse wasted a lot of my time. Qt advice says NOT to use the eclipse

                    that comes with various distros.

                    I love QT SDK

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      cloudbuster
                      wrote on last edited by
                      #11

                      Qt examples are usually overly complex.

                      The 3 examples I've just got running are superb mentoring examples.

                      In MHO

                      I can email to anybody!

                      Qt should be avail to get/update under Fedora yum

                      as easy as

                      yum install qtsdk

                      1 Reply Last reply
                      0

                      • Login

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