Re: Command line arguments




2013-11-24 08:07, a skrev:
Hi, I am trying to parse some command line arguments within my program. This is what I have:

Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "Math.Calculator.Fractions");

    Math::Gui::MainWindow mw(argc, argv);
   
    return app->run(mw);

when I run the program I get the error message:

"GLib-GIO-CRITICAL **: This application can not open files."

The only information I can find about command line arguments is using Gio::APPLICATION_HANDLES_COMMAND_LINE flag and connect to Gio::Application::signal_command_line().

Is there a simpler way?

Thank you.


The gtkmm tutorial shows two ways of handling command line arguments, but it's described in a place where you probably don't think of searching for it (I'm to blame for that):
https://developer.gnome.org/gtkmm-tutorial/stable/sec-multi-item-containers.html.en#boxes-command-line-options
Look also at main.cc in the example after the description.

Gtk::Application ought to have a chapter of its own in the tutorial, but so far no one has taken the time to write that chapter. Much more than handling command line arguments ought to be described in such a chapter.

Kjell



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]