[Qt-interest] Former Console App on Windows No Longer Shows Text
William Gordon Rutherdale (rutherw)
rutherw at cisco.com
Fri Jul 15 23:45:44 CEST 2011
Worked like a charm: CONFIG += console
I tested it on Windows (running from a DOS prompt) and it worked just fine. I also tested on Linux (same .pro file) and there was no problem there.
Thanks to everyone else who offered suggestions.
-Will
> -----Original Message-----
> From: qt-interest-bounces+rutherw=cisco.com at qt.nokia.com [mailto:qt-
> interest-bounces+rutherw=cisco.com at qt.nokia.com] On Behalf Of K. Frank
> Sent: 15 July 2011 09:51
> To: Qt-interest
> Subject: Re: [Qt-interest] Former Console App on Windows No Longer
> Shows Text
>
> Hello William!
>
> On Thu, Jul 14, 2011 at 2:07 PM, William Gordon Rutherdale (rutherw)
> <rutherw at cisco.com> wrote:
> > Hi.
> > ...
> > It was originally a console app. However, I needed to add a control
> > button, so I added minor gui control to it. I thus took out the 'QT
> -=
> > gui' line from the .pro file and added some buttons.
>
> I'm guessing, as you see, that activating the gui removes support for
> the
> console by default.
>
> > The old version had command-line help and other console output, e.g.
> > when you run it with the -h switch. This console output was produced
> > using qDebug().
> >
> > The new version still does that on Linux. However, when it runs on
> > Windows the console output has disappeared.
> >
> > Is there any way to get it to put this output onto the console when
> it
> > is running under Windows?
>
> I believe you can get your console window back if you add something
> like:
>
> CONFIG += console
>
> to your .pro file.
>
> I don't understand exactly how this works. (For example, you seem to
> be
> working with the QT configuration variable, and I use the CONFIG
> variable.
> Also, there seems to be some kind of "automatic" default behavior going
> on in that leaving "gui" active turns off the console unless you
> explicitly
> turn it back on.)
>
> In my typical use case I launch my Qt gui applications from the command
> line. (I like to set up certain paths and other environment
> variables.) In my
> case, then, setting "CONFIG += console" sets up Qt console output so
> that
> it appears in the command prompt from which I started the application.
>
> I *think* (on windows) that if you add "CONFIG += console" to a gui
> project,
> and then launch the application from, e.g., the start menu, Qt /
> windows will
> automatically create a console window for you in which your console
> output
> will appear.
>
> Anyway, you *can* get console output with a Qt gui application on
> windows.
> Try out the above, and if it doesn't work, post back with some more
> detail,
> and I'll see if I can sort through what I've done and get it to work
> for you.
>
> > -Will
>
> Good luck.
>
>
> K. Frank
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list