PDA

View Full Version : Runtime problem in Release mode



benelgiac
15th December 2009, 12:01
Hi All,

I'm using Qt SDK 2009.5 and developing using QtCreator and the bundled MinGW on Windows 7 x64. So far, in debug mode, everything worked just fine and my application builds, runs and can be debugged without problems.

When I try to run the application compiled in release mode, I get the runtime error "Unable to find entry point _Z9qBadAllocv in QtCore4.dll".

I haven't found any way to fix it so far. By doing an "nm" on the static QtCore4.a I have seen that indeed it contains _Z9qBadAllocv... so I'd expect to find it also in the dll.

Any pointers? Thanks !

Giacomo

rittchat
16th December 2009, 07:04
Hi,

I am facing this problem in debug mode too. My OS is Windows XP SP2. Please tell me how you able to run your program in debug mode.

regards
rittchat

benelgiac
16th December 2009, 11:35
I haven't done anything special. I created an empty project with Creator, populated it with my files and everything worked out of the box.

I also tried to use the qt command line. I removed every file from my project folder ( except sources and ui file naturally :p ) then ran "qmake -project", "qmake", "make". Both debug and release binaries are created, but the release exe still presents the same problem.

My sensation is that Creator has some minor bugs. For example, every time I open my project, I have to remove Makefiles, .user file, debug and release folder or I get the error "The process could not be started!" when I try to run my app.

Nothing special but still annoying

rittchat
16th December 2009, 12:24
I also tried to use the qt command line. I removed every file from my project folder ( except sources and ui file naturally :p ) then ran "qmake -project", "qmake", "make". Both debug and release binaries are created, but the release exe still presents the same problem.

In my case whenever I am trying 'make' it is saying that

'make' is not recognized as an internal or external command, operable program of batch file.

But when I am running 'mingw32-make' it is creating the debug binary only. But the problem still exist.

regards
rittchat

squidge
16th December 2009, 14:26
You are using the wrong DLL. Use the one in the 'qt/bin' dir rather than the one in the 'bin' dir. For a test, you can copy it to your apps release folder.

benelgiac
16th December 2009, 15:54
Hi, I had not realized there are two bin folders, \qt\bin and \bin. What's the difference between the two?

Unfortunately, by copying one or the other dll in my release folder, I still get an "entry point not found" error. It happens on two different entry points, but still an error.

john_god
16th December 2009, 22:55
You are using the wrong DLL.
No he is not. I have the same problem, I already tested all the qtcore4.dll, copy all of them, did lots os tests, and the problems persists. I put a thread the forum "instalation and deployment" and still havent figured this out. Is not the code either because runs fine in linux, and happens the same with empty projects, works good in debug and crashes in release. I'm using Vista.

squidge
16th December 2009, 23:36
Well, what can I say? "Unable to find entry point" means exactly that - that it can't find that particular function in the DLL file. Since Qt ships with pretty much every function available in the DLL, the only explanation is that the system is trying to use a custom-compiled QtCore DLL which doesn't have the function that the program needs. If the function wasn't in the DLL, the linker would complain when you ran it, as it wouldn't be able to find the function in the dynamic version of the .a file either.

Maybe you should host your executable which doesn't work somewhere for someone else to test. If it works on there PC, then it's definitely a DLL issue.

wysota
17th December 2009, 01:45
Since Qt ships with pretty much every function available in the DLL, the only explanation is that the system is trying to use a custom-compiled QtCore DLL which doesn't have the function that the program needs.

Or that the function is at different offset in the library which may happen when trying to run the application against a different version of the library it was linked against (i.e. running against 4.7 while building against 4.6). Which may happen exactly when you take the dll from qtsdk\bin\ instead of qtsdk\qt\bin as already mentioned. Maybe the export library is broken?

john_god
17th December 2009, 04:35
Maybe the export library is broken? can you explain this ?
Here is a exe from a empty project, if someone could test it, thank you.

rittchat
17th December 2009, 07:24
Hi,

The attached exe file in XP producing same error. I also tried Win7. Same thing had happened as mentioned by benelgiac. It is running fine in debug mode. In release mode only qt creator can run the exe :eek:. But in Xp nothing is running :mad:.

regards
rittchat

wysota
17th December 2009, 09:35
can you explain this ?

What exactly? If the export library is incorrect then the resulting executable will not link against an incompatible dll during runtime.

ericV
17th December 2009, 12:16
When I began programming with QT earlier this year I ran into the same Problem.

When you run from Creator everything works fine. But when you run the EXE it complains about missing DLL(s).

I think this has something to do with the build configuration... (have not found how to solve it here)

But, i found that if you copy the Dlls into the applicationfolder it will link and run... You might need more than 1 dll, depending on what Qt Modules your programm uses.

For me it was necesary to copy following Files (Application is a Custom rich Text Editor)

mingwm10.dll
msvcrt.dll
QtCore4.dll
QtGui4.dll

Somewhere I found an Article that lead me to this solution including a small app called "Depends" which will help you find out which dlls your exe needs.

I hope this helps...

Eric

john_god
17th December 2009, 23:09
What exactly?

I dont know what a export library is, is it the dll ? I deleted the previous Qt version before installng the current one, so there shouldnt be older dll to cause caos.


Maybe the export library is broken?
How can I fix it?

ChrisW67
17th December 2009, 23:39
Hi, I had not realized there are two bin folders, \qt\bin and \bin. What's the difference between the two?

The files in the /bin directory are the runtime libraries against which the bundled Qt Creator has been built. They have probably been built using the Microsoft VC++ compiler. The files in /qt/bin are the runtime libraries (debug and release) as built using the bundled MingW compiler. These are the files Qt Creator will use when it builds and runs your program, and the files you should deploy.

The separation is there to allow the Qt Creator to run independently of any version of Qt, or set of configuration settings, you may be developing your application against.

squidge
17th December 2009, 23:42
I dont know what a export library is, is it the dll ? I deleted the previous Qt version before installng the current one, so there shouldnt be older dll to cause caos. You should search your system to ensure that is the case. Any application can install the Qt libraries and modify your system search path.

wysota
18th December 2009, 01:02
I dont know what a export library is, is it the dll ?
No. It has a "lib" extension for MSVC libraries and "a" for MinGW ones.


I deleted the previous Qt version before installng the current one, so there shouldnt be older dll to cause caos.

If you have Qt SDK installed, you have at least two versions of Qt in your system.

rittchat
18th December 2009, 09:54
One thing I have discovered today, that when I am installing Qt on the folder C:\Qt it is working in Xp but if I am installing Qt in folder C:\Qt\2009.5 (which is the default folder of installation) it is not working.

second thing is that even in this case also release build is not working UNLESS I copy qtcore4.dll and qtGui4.dll from C:\Qt\qt\bin folder to release folder. I find that qtCore4.dll in C:\Qt\bin folder have different size than qtCore4.dll in C:\Qt\qt\bin folder. Please let me know that whether release build is working or nor in Win7 after copying these 2 dlls.

regards
rittchat

jpujolf
18th December 2009, 10:14
One thing I have discovered today, that when I am installing Qt on the folder C:\Qt it is working in Xp but if I am installing Qt in folder C:\Qt\2009.5 (which is the default folder of installation) it is not working.

One idea : it's not the first time you install QT, isn't it ? So, perhaps you have an old C:\Qt\bin in your path before C:\Qt\2009.5\qt\bin and O.S. searches missing DLLs in that path before.

As wysota said, on qtsdk/bin are the qtcreator DLLs ( release mode ) and in qtsdk/qt/bin are the redistributable DLLs so when you try to execute release version, execution fails.


second thing is that even in this case also release build is not working UNLESS I copy qtcore4.dll and qtGui4.dll from C:\Qt\qt\bin folder to release folder. I find that qtCore4.dll in C:\Qt\bin folder have different size than qtCore4.dll in C:\Qt\qt\bin folder.

Of course that copying DLLs works !! WIndows first searches needed DLLs on exe's path, then following PATH variable and - if I'm not confused - on system paths...

Checks environment variables, there must be the error, for sure.

squidge
18th December 2009, 11:12
Open a command prompt (Start->Run->Cmd) and then type "echo %PATH%" and post your findings.

john_god
19th December 2009, 14:02
Well I got this working now

1) Make sure you have the path system with this

c:\qt\2009.05\qt\bin;c:\Qt\2009.05\bin

respect the order this is important

2) check your "windows\system32" dir and see if there is any
qt dll's like qtcore4.dll, qtcore4d.dll qtgui.dll qtopengl.dll., etc

if there are, and if you know that you dont have any program that will need them,
just deleted them, if not update them with the dll's from c:\qt\2009.05\qt\bin.
This should work.

The problem is that if you have the correct path, it will still crash because it will
look first in the windows system for the librarys.

And if you update the windows system with qtcore4.dll it will still crash because will
use the wrong qtgui.dll and others altought (and this is the nasty part to debug) the error message will still be related with qtcore4.dll.

So in windows\system32 you have to update all of them, or delete all of them.

troy_Aus
15th December 2010, 12:28
This problem may be solved but I still found it diffcult to grasp the solution initially as I had no idea about system Variable. I use Win 7 x64 and the solution that work for me was editting the 'Path' variable in the 'System Variables' section of 'Environmental Variables'. This is very important to getting a working solution. If you modify the 'User Variables' this typically will not solve your problem because this issue is caused by other programs installed on your PC contain a version of Qtcore4.dll. So simple select 'Path' from your 'System Variables' and select edit. Now at the very start of all of the variables that exist add the path to Qt. For me the path's were 'C:\Qt\2010.05\qt\bin;C:\Qt\2010.05\bin'

Hope this helps as Qt is working perfectly for me now.

Troy

surendra1234sharma
20th February 2013, 11:45
still i am getting same error "exited with code -1073741511"
my system configuration is
windows 7, 32 bit
qt 2010.04
opencv2.4.3
please help me to sort it out

wysota
20th February 2013, 13:59
What did you already try to fix your problem?