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

Qt-interest Archive, August 2006
can't move qt4 program to WinXP


Message 1 in thread

Dear List,

I developed my first Qt4(.1.4) program on my Mac and everything is fine.  I
moved over to a WinXP box, installed Qt 4.1.4 open source with MinGW, and
compiled.  When I run, it crashes ("Sorry but this program has to close...do
you want to tell Microsoft?") immediately.

I try adding debugging information (because I'm running it from a command
prompt) but the debugging messages don't get printed.  Heck, I commented out
everything in main.cpp except for
    qDebug( "point 0" );
    return 0;
and it still won't print anything to the console (although it doesn't crash
anymore).

What must I to do see the debugging messages?  I've tried
    QT += console
    CONFIG += debug
and I'm running the .exe that was built in the debug directory, but it's not
helping; I just get my prompt back right away.

TIA

Nathan


--
 [ signature omitted ] 

Message 2 in thread

Oh, and I tried what's here
    http://doc.trolltech.com/4.1/qtglobal.html#qInstallMsgHandler
but it didn't change anything--still no output, just get my prompt back.

#include <QApplication>
//etc...

void myMessageOutput ( QtMsgType type, const char *msg)
{
    // body of this function as in above documentation
}

int main ( int argc, char *argv[] )
{
    qInstallMsgHandler(myMessageOutput);
    QApplication app(argc,argv);
    qDebug( "point 0" );
/*
    a bunch of stuff here commented out
*/
    return 0;
}

does NOTHING but give me my prompt back.

Nathan


On 8/2/06 3:56 PM, "Nathan Carter" <ncarter@xxxxxxxxxxx> wrote:

> 
> Dear List,
> 
> I developed my first Qt4(.1.4) program on my Mac and everything is fine.  I
> moved over to a WinXP box, installed Qt 4.1.4 open source with MinGW, and
> compiled.  When I run, it crashes ("Sorry but this program has to close...do
> you want to tell Microsoft?") immediately.
> 
> I try adding debugging information (because I'm running it from a command
> prompt) but the debugging messages don't get printed.  Heck, I commented out
> everything in main.cpp except for
>     qDebug( "point 0" );
>     return 0;
> and it still won't print anything to the console (although it doesn't crash
> anymore).
> 
> What must I to do see the debugging messages?  I've tried
>     QT += console
>     CONFIG += debug
> and I'm running the .exe that was built in the debug directory, but it's not
> helping; I just get my prompt back right away.
> 
> TIA
> 
> Nathan


--
 [ signature omitted ] 

Message 3 in thread

> int main ( int argc, char *argv[] )
> {
>     qInstallMsgHandler(myMessageOutput);
>     QApplication app(argc,argv);
>     qDebug( "point 0" );

>     return 0;
> }
> 
> does NOTHING but give me my prompt back.


Try
	CONFIG += console

(instead of QT += console) If that doesn't help, replace your main file 
with:

#include <iostream>

int main(int, const char**) {
	std::cout << "Hi!" << std::endl;
	return 0;
}

, and compile that via your Qt project file. This really must work. If 
it doesn't then there is something really smelling...

/eno

--
 [ signature omitted ] 

Message 4 in thread

On Wednesday 02 August 2006 21:56, Nathan Carter wrote:
> What must I to do see the debugging messages? 

Install GDB from the MinGW site and start the program in the debugger:
c:\> gdb myprog.exe
gdb) run

That way gdb will catch the messages from the debug channel and display them 
properly.

...and no, I did not find out what idiot at M$ thought it a good idea to 
hide debug messages from normal users.



	Konrad

Attachment:

Attachment: pgplRXLewZ8NU.pgp
Description: PGP signature


Message 5 in thread

>> What must I to do see the debugging messages?

> Install GDB from the MinGW site and start the program in the debugger:
c:\>> gdb myprog.exe
> gdb) run

> That way gdb will catch the messages from the debug channel and display them
> properly.

Check for DebugView from www.sysinternals.com


-- 
 [ signature omitted ] 

Message 6 in thread

> I developed my first Qt4(.1.4) program on my Mac and everything is
> fine.  I moved over to a WinXP box, installed Qt 4.1.4 open source
> with MinGW, and compiled.  When I run, it crashes ("Sorry but this
> program has to close...do you want to tell Microsoft?")
> immediately.
> 
> I try adding debugging information (because I'm running it from a
> command prompt) but the debugging messages don't get printed. 
> Heck, I commented out everything in main.cpp except for
>     qDebug( "point 0" );
>     return 0;
> and it still won't print anything to the console (although it
> doesn't crash anymore).
> 
> What must I to do see the debugging messages?  I've tried
>     QT += console
>     CONFIG += debug
> and I'm running the .exe that was built in the debug directory, but
> it's not helping; I just get my prompt back right away.


First of all,
    CONFIG += console
will make your application a Console application. Adding 'console' to
Qt will not make it a console library ;-)

Well, if your application is a non-console application it by default
does not have any consoles attached to the process, so all console
output falls into the abyss and disappears. However, there are two
ways of catching the debug (text from OutputDebugString,
Out_Debug_String, _Debug_Printf_Service and DbgPrint) messages before
they fall:
   1) Start your application from the debugger. The debugger will
      catch these messages and put them in the Output pane.
   2) Install DebugView from Sysinternals. It's a light-weight
      application wich will do the same thing as the debug for
      your whole system. It captures debug output for all process
      running, and outputs it to its own window, where you can
      filter and highlight based on keywords. 
      
http://www.sysinternals.com/Utilities/DebugView.html will give you
more information about this. 

-- 
 [ signature omitted ] 

Message 7 in thread

The replies below solved my problem.  Thank you for noting that subtle but
crucial point! :)

PS: Oliver, if I can't find any of my code responsible for this crash, it
may be related to what you said, but since I've just got a fresh box with
MinGW only, it seems unlikely.  I'll let you know if it seems related.


On 8/3/06 3:26 AM, "Marius Storm-Olsen" <marius_noreply@xxxxxxxxxxxxx>
wrote:

> First of all,
>     CONFIG += console
> will make your application a Console application. Adding 'console' to
> Qt will not make it a console library ;-)

On 8/2/06 5:41 PM, "troll@xxxxxxxxxxxx" <troll@xxxxxxxxxxxx> wrote:

> Try
> CONFIG += console
> 
> (instead of QT += console) 


--
 [ signature omitted ] 

Message 8 in thread

Nathan Carter schrieb:
> Dear List,
> 
> I developed my first Qt4(.1.4) program on my Mac and everything is fine.  I
> moved over to a WinXP box, installed Qt 4.1.4 open source with MinGW, and
> compiled.  When I run, it crashes ("Sorry but this program has to close...do
> you want to tell Microsoft?") immediately.

Ahh.. that rings a bell: First off, we're not compiling with MinGW but
with Visual Studio 2005. But since this error message sounds very
familiar to me it might be connected anyway.


We have a laptop in Italy in one of our offices (and off course I'm
sitting here in Zurich with no access to this laptop) which also shows
such a message immediatelly after application startup; in italian off
course, but I believe it means pretty much the same, see attachement ;)

The funny thing is it's not one of the usual "segmentation fault" or
"DLL missing" kind of errors. In fact, I couldn't reproduce such an
error message as of now (but we have a test machine which shows similar
problems, but I have yet to verify this, see below).

Another point: the same application (somewhat older version though)
compiled with Visual Studio 2003 WORKS on this laptop. But now since we
compile the latest version with Visual Studio 2005 it doesn't work on
that laptop. Off course it runs almost (see below) everywhere on any
other WinXP in our office here (and we took care that no Visual Studio
had previously been installed, together with any runtime DLLs).

So my idea was that it has something to do with this "manifest" stuff
which is new to Visual Studio 2005. And in fact we do have a funny test
machine which shows a similar problem (I have yet to find out if it also
produces exactly this error dialog).

BUT: if we put the Microsoft.VC80.DebugCRT.manifest (in ADDITION to the
Microsoft.VC80.CRT.manifest) file into the application folder it
supposedly works on that test machine! According to the developer who
has "discovered" this there are NO debug C++ runtime DLLs on that
machine. The only runtime DLLs we put into the application folder are
the release ones: 'msvcp80.dll' and 'msvcr80.dll' (for now we simply put
those DLLs there instead of executing 'vcredist_x86.exe' which would put
those DLLs somewhere under c:\windows\winsxs, or so I understand - but
even executing this 'vcredist_x86.exe' on the "italian laptop" doesn't
make any difference there).

Now our application links together with a static lib of our own, but
which was compiled with Visual Studio 2003 (for other reasons, because
this static library links again with another 3rd party binary only
static library compiled with Visual Studio 2003). Now when I remove this
library from our *.exe it RUNS on that italian laptop! Maybe mixing
2003/2005 binary code (together with this manifest stuff maybe?) is a
bad mixture...

Does that ring a bell with anyone? I don't know much yet about this
manifest stuff, just that it is a new "DLL loading mechanism" supported
by WinXP and Win2003 Server; the manifest files specify which "DLL
packages" the application is supposed to load and where they are
located. But dare you you forget to ship the .manifest file ...


Cheers, Oliver

PNG image

PNG image


Message 9 in thread

Till Oliver Knoll schrieb:
> Nathan Carter schrieb:
>> Dear List,
>>
>> I developed my first Qt4(.1.4) program on my Mac and everything is fine.  I
>> moved over to a WinXP box, installed Qt 4.1.4 open source with MinGW, and
>> compiled.  When I run, it crashes ("Sorry but this program has to close...do
>> you want to tell Microsoft?") immediately.
> 
> Ahh.. that rings a bell: First off, we're not compiling with MinGW but

Forgot: we're still using Qt3, so I believe this is not a Qt-specific
issue (at least not a Qt version issue), but nevertheless interesting
enough (to me ;)

Cheers, Oliver

--
 [ signature omitted ] 

Message 10 in thread

> Ahh.. that rings a bell: First off, we're not compiling with MinGW but
> with Visual Studio 2005. But since this error message sounds very
> familiar to me it might be connected anyway.

Oliver,

*blush* Actually I had a divide by zero in my code that PPC didn't seem to
mind but Intel did.  Oops!

Nathan


--
 [ signature omitted ]