Almost there...where does the argument list go



  • program not seeing arguments

    normally I use

    ./QtFigs4 figs.xml

    for execution... but where do I specify figs.xml

    I looked all over

    I even put the following:

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

    in GDB startup script under gdb option

    This program has been running 11 years.

    It is an excellent intro to SAX, paintEvent and collections.



  • 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...
    ...
    }
    @


  • Moderators

    [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



  • 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)


  • Moderators

    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.



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

    I looked around for arguments but found nado


  • Moderators

    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



  • 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!"



  • 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



  • 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



  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.