1

I am using Qt 4.8.3 mingw 4.7 Windows 7 x64 . The exe file doesn't work..

Problem signature:
  Problem Event Name:   APPCRASH
  Application Name: hello.exe
  Application Version:  0.0.0.0
  Application Timestamp:    509d1749
  Fault Module Name:    QtCore4.dll
  Fault Module Version: 4.8.3.0
  Fault Module Timestamp:   504ee1c2
  Exception Code:   c0000005
  Exception Offset: 001103e8
  OS Version:   6.1.7601.2.1.0.256.4
  Locale ID:    1067
  Additional Information 1: 0a9e
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
  Additional Information 3: 0a9e
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

Here is the very simple source code:

#include <QApplication>
#include <QLabel>

int main(int argc, char *argv[])
{
   QApplication app(argc, argv);
   QLabel *label = new QLabel("Hello Qt!");

   label->show();

   return app.exec();
}
jogojapan
  • 68,383
  • 11
  • 101
  • 131
user1740587
  • 263
  • 1
  • 2
  • 8
  • Did you try to debug your application ? – Synxis Nov 09 '12 at 15:02
  • Does this only happen when trying to launch the exe manually? Does it work when running it from within Qt Creator? – Nikos C. Nov 09 '12 at 15:06
  • Sinxis vs 2012 says Unhandled exception at 0x6E1D03E8 (QtCore4.dll) in hello.exe: 0xC0000005: Access violation reading location 0x01040807. – user1740587 Nov 09 '12 at 15:14
  • Nikos I have tried.. don't work – user1740587 Nov 09 '12 at 15:25
  • 1
    Where did you get the dll from ? Make sure the dll corresponds to your Qt version. – octal Nov 09 '12 at 15:51
  • Agree with Synxis, did you try to debug your application? Or at least could you try it with commenting the lines which are include Qlabel item? (I'm trying to localize the problem.) – emreakyilmaz Nov 09 '12 at 15:57
  • emreakyilmaz I have debugged with VS2012 it sas"Unhandled exception at 0x6E1D03E8 (QtCore4.dll) in hello.exe: 0xC0000005: Access violation reading location 0x01040807." if push Continue the same problem dialog asks again. – user1740587 Nov 09 '12 at 16:49

1 Answers1

3

The Qt 4.8.3 MinGW library that you can download from qt-project.org was built with MinGW 4.4. If you're using that library, you'll have problems trying to use MinGW 4.7.

MinGW 4.7.0 changed the default calling convention for C++ class members to __thiscall, so C++ programs built with MinGW 4.7.0 or later are not compatible with libraries or object files built with earlier versions of MinGW. See https://stackoverflow.com/a/13134812/12711 for more details.

You'll need to use an older version of MinGW (ideally 4.4) or you'll need to rebuild the Qt library with the version of MinGW you're using. If you try to rebuild Qt and run into problems, this SO answer may have some helpful pointers.

Community
  • 1
  • 1
Michael Burr
  • 333,147
  • 50
  • 533
  • 760