Qt Application throws an Access violation exception during startup

2

I have a Qt Application that works in Debug mode without any problems. Since two days I'm trying to make it work in Release mode. After some Project property modification I managed to compile without errors. But unfortunalty the application crashes before even reaching the main method. That's my environment:

  • MS VS 2010
  • Qt 4.8.4
  • Qwt 6.0.0

I don't know if this is relevant, but I also installed the Qt plugin for VS and used Qt Designer to create my GUI.

As I said in Debug mode there is no problem. Starting the release version from the Visual Studio produces the following error: Unhandled exception at 0x77c415de in Application.exe: 0xC0000005: Access violation reading location 0x0000000c.

The last function I can "debug" is the the "WinMain" method called inside the method "__declspec(noinline) int __tmainCRTStartup", which is located in crtexe.c (honestly I have no idea what this is). The call stack looks like this:

ntdll.dll!77c415de()    
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] 
ntdll.dll!77c415de()    
ntdll.dll!77c3014e()    
msvcr100.dll!718f0269()     
msvcr100.dll!718f233b()     
msvcr100.dll!718f233b()     
msvcr100.dll!718f233b()     
QtCore4.dll!5b2cfc49()  
QtGui4.dll!57bf54ea()   
Application.exe!__tmainCRTStartup()  Line 547 + 0x1c bytes  C
kernel32.dll!754633aa()     
ntdll.dll!77c59ef2()    
ntdll.dll!77c59ec5()    

In the moment I'm totaly lost with this problem. No idea what to try further...

I've tried to reduce the program and commented out the complete main function. But the result was the same behaviour. As I said the error occurs even before the main function is called. I also turned off all optimization and recompiled... didn't changed anything.

What completly puzzles me, is the fact that it "works" when I call "Application.exe" from the command prompt (ok it also crashes but much later during execution). Weird, isn't it? What is the difference between starting from command prompt and starting from Visual Studio application?

qt
release
startup
access-violation
asked on Stack Overflow Mar 6, 2013 by Seba Stopol • edited Dec 15, 2017 by Vadim Kotov

2 Answers

0

The problem is not in QT but in your source code. "0xC0000005: Access violation reading location 0x0000000c" means that you try to access a wrong memory location.

Check out your arrays, ans pointers.

answered on Stack Overflow Mar 7, 2013 by npiau • edited Dec 15, 2017 by Vadim Kotov
0

AnatolyS and npiau thanks for you tips. Meanwhile I continued digging in my code. More or less I started from the very beginning and finally got the place the error occurs. I suppose npiau is right, it has nothing to do with Qt.

It's still (for me) a strange problem. I posted it in a new thread (because it has little to do with this thread): C++ Creation of a Singleton object in initializer list causes an Access Violation (only Release Mode)

answered on Stack Overflow Mar 8, 2013 by Seba Stopol • edited May 23, 2017 by Community

User contributions licensed under CC BY-SA 3.0