Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, October 2006
Windows console output for win32 app?


Message 1 in thread

Does anyone have a good way of getting the stdout/stderr for a win32
app in Visual Studio? I need to check things like qDebug output and
QObject::connect errors...

-- 
 [ signature omitted ] 

Message 2 in thread

This code will show you messagebox in case of error
void myMessageOutput(QtMsgType type, const char *msg)
{
	switch (type) {
	case QtDebugMsg:
		QMessageBox::information(0, "Debug message", msg, QMessageBox::Ok);
		break;
	case QtWarningMsg:
		QMessageBox::warning(0, "Warning", msg, QMessageBox::Ok);
		break;
	case QtCriticalMsg:
		QMessageBox::critical(0, "Critical error", msg, QMessageBox::Ok);
		break;
	case QtFatalMsg:
		QMessageBox::critical(0, "Fatal error", msg, QMessageBox::Ok);
		abort();
	}
}

int main(int argc, char *argv[])
{
	qInstallMsgHandler(myMessageOutput);
	QApplication app(argc, argv);
	MainWindow	window;
	window.show();	
	return app.exec();
 }

2006/10/18, Patrick Stinson <patrickkidd.lists@xxxxxxxxx>:
> Does anyone have a good way of getting the stdout/stderr for a win32
> app in Visual Studio? I need to check things like qDebug output and
> QObject::connect errors...
>
> --
> Patrick Kidd Stinson
> http://www.patrickkidd.com/
> http://pkaudio.sourceforge.net/
> http://pksampler.sourceforge.net/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>

--
 [ signature omitted ] 

Message 3 in thread

On Wed, 2006-10-18 at 11:30 -0800, Patrick Stinson wrote:

> Does anyone have a good way of getting the stdout/stderr for a win32
> app in Visual Studio? I need to check things like qDebug output and
> QObject::connect errors...


Using MinGW, I add the line "CONFIG += console" to the .pro file. This
will cause a command prompt window to come up with the application. All
qDebug() output will go to the command prompt window. Don't know if this
will work with Visual Studio.
-- 
 [ signature omitted ] 

Message 4 in thread

In Visual Studio, right click on your project and select Properties.  In
the resulting dialog, go to "Configuration Properties->Linker->System".
On that tab, the first item should be "Subsystem", set the value of that
property to "Console (/SUBSYSTEM:CONSOLE)".  Apply the changes and next
time you launch your app, it should have a console window attached to
it.

Sean

-----Original Message-----
From: Patrick Stinson [mailto:patrickkidd.lists@xxxxxxxxx] 
Sent: Wednesday, October 18, 2006 3:30 PM
To: qt-interest@xxxxxxxxxxxxx
Subject: Windows console output for win32 app?

Does anyone have a good way of getting the stdout/stderr for a win32 app
in Visual Studio? I need to check things like qDebug output and
QObject::connect errors...

--
 [ signature omitted ] 

Message 5 in thread

My program is specifically not a console program.

On 10/18/06, Murphy, Sean M. <sean.murphy@xxxxxxxxxx> wrote:
> In Visual Studio, right click on your project and select Properties.  In
> the resulting dialog, go to "Configuration Properties->Linker->System".
> On that tab, the first item should be "Subsystem", set the value of that
> property to "Console (/SUBSYSTEM:CONSOLE)".  Apply the changes and next
> time you launch your app, it should have a console window attached to
> it.
>
> Sean
>
> -----Original Message-----
> From: Patrick Stinson [mailto:patrickkidd.lists@xxxxxxxxx]
> Sent: Wednesday, October 18, 2006 3:30 PM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: Windows console output for win32 app?
>
> Does anyone have a good way of getting the stdout/stderr for a win32 app
> in Visual Studio? I need to check things like qDebug output and
> QObject::connect errors...
>
> --
> Patrick Kidd Stinson
> http://www.patrickkidd.com/
> http://pkaudio.sourceforge.net/
> http://pksampler.sourceforge.net/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>


-- 
 [ signature omitted ] 

Message 6 in thread

Patrick Stinson wrote:
> Does anyone have a good way of getting the stdout/stderr for a win32
> app in Visual Studio? I need to check things like qDebug output and
> QObject::connect errors...
> 

install a qMessageHandler, which spits out the messages to Windows'
	OutputDebugString
function. This produces some nice debug output during debug runs (i.e. 
by pressing F5).

/eno

--
 [ signature omitted ] 

Message 7 in thread

eno wrote:
> Patrick Stinson wrote:
> > Does anyone have a good way of getting the stdout/stderr for a win32
> > app in Visual Studio? I need to check things like qDebug output and
> > QObject::connect errors...
> > 
> 
> install a qMessageHandler, which spits out the messages to Windows'
> 	OutputDebugString
> function. This produces some nice debug output during debug 
> runs (i.e. by pressing F5).

And when you format your message like this:

  ... << file << '(' << line << ") : " << msg

you can double click on that line in the log window and the editor will
jump to the file and line given in the message.

Andre'

--
 [ signature omitted ] 

Message 8 in thread

> And when you format your message like this:
> 
>   ... << file << '(' << line << ") : " << msg
> 
> you can double click on that line in the log window and the editor will
> jump to the file and line given in the message.
> 
And if you use a macro like

#define QDEBUG qDebug << __FILE__ << '(' << __LINE << ") : "

you even don't have to pass file and line number manually.


/eno

--
 [ signature omitted ] 

Message 9 in thread

nice!

On 10/19/06, troll@xxxxxxxxxxxx <troll@xxxxxxxxxxxx> wrote:
>
> > And when you format your message like this:
> >
> >   ... << file << '(' << line << ") : " << msg
> >
> > you can double click on that line in the log window and the editor will
> > jump to the file and line given in the message.
> >
> And if you use a macro like
>
> #define QDEBUG qDebug << __FILE__ << '(' << __LINE << ") : "
>
> you even don't have to pass file and line number manually.
>
>
> /eno
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>


-- 
 [ signature omitted ] 

Message 10 in thread

Am Mittwoch, 18. Oktober 2006 21:30 schrieb Patrick Stinson:
> Does anyone have a good way of getting the stdout/stderr for a win32
> app in Visual Studio? I need to check things like qDebug output and
> QObject::connect errors...
you have to compile your application as console-application. (pass additional 
flag to linker, I don't know it for MSVC, but for GCC it's -mconsole)

toby

Attachment:

Attachment: pgpKI6O1gyPne.pgp
Description: PGP signature


Message 11 in thread

... and if all else fails, there's always DebugView:

www.sysinternals.com/Utilities/DebugView.html

Sam Dutton


 





SAM DUTTON
SENIOR SITE DEVELOPER

200 GRAY'S INN ROAD
LONDON
WC1X 8XZ
UNITED KINGDOM
T +44 (0)20 7430 4496
F 
E SAM.DUTTON@xxxxxxxxx
WWW.ITN.CO.UK

-----Original Message-----

From: Patrick Stinson [mailto:patrickkidd.lists@xxxxxxxxx] 
Sent: Wednesday 18 October 2006 20:30
To: qt-interest@xxxxxxxxxxxxx
Subject: Windows console output for win32 app?

Does anyone have a good way of getting the stdout/stderr for a win32 app
in Visual Studio? I need to check things like qDebug output and
QObject::connect errors...

--
 [ signature omitted ] 

Message 12 in thread

Dutton, Sam wrote:
> ... and if all else fails, there's always DebugView:
> 
> www.sysinternals.com/Utilities/DebugView.html
> 
> Sam Dutton

...but AFAIK Qt's debug output doesn't go to the system debugger by default.


/eno

--
 [ signature omitted ]