DLL trouble
-
Sup. I have some problems with DLL loading by QtCreator. If I run my program from QtCreator, it crashes with segmentation fault. But if I run my program manually, everything looks fine. Also everything looks fine in debug mode. I have troubles only with release. Any suggestions?
Here is my .pro file: screenshot -
Hi, and welcome to the Qt Dev Net!
You could be accidentally loading different DLLs. Use Sysinternals ListDLLs to check: https://technet.microsoft.com/en-us/sysinternals/bb896656.aspx?f=255&MSPPError=-2147217396
- Run your program manually.
- While your program is running, use ListDLLs to see which DLLs your program has loaded.
- Close your program.
- Run your program from Qt Creator.
- While your program is running (or when the crash dialog is showing), use ListDLLs to see which DLLs your program has loaded.
Are they the same?
-
Debug version:
0x000000006e580000 0x1f9000 C:\Users\nio_x\Documents\qtProjects\nioEngine\build\debug\nioEngine.dll
Verified: Unsigned
Publisher: n/a
Description: n/a
Product: n/a
Version: n/a
File version: n/aRelease version launched from QtCreator:
0x00000000629c0000 0xe9000 C:\Users\nio_x\Documents\qtProjects\nioEngine\build\release\nioEngine.dll
Verified: Unsigned
Publisher: n/a
Description: n/a
Product: n/a
Version: n/a
File version: n/a
Create time: Sat Jul 10 11:37:36 1971Release version launched manually:
0x00000000629c0000 0xe9000 C:\Users\nio_x\Documents\qtProjects\nioEngine\build\release\nioEngine.dll
Verified: Unsigned
Publisher: n/a
Description: n/a
Product: n/a
Version: n/a
File version: n/a
Create time: Sat Jul 10 11:37:36 1971Engine DLLs are the same.
-
If you need full output, here is release version launched from QtCreator, and here is release version launched manually. I realized that QtCreator loads MinGW DLLs that comes with Qt SDK instead of my own MinGW distro, and it may be root of the problem.
But here is debug version launched from QtCreator, and it seems that QtCreator loads it own MinGW DLLs, but program doesn't crash as in release version. I am totally confused.
Here is debug version launched manually. Different DLLs as for release versions, but doesn't crash. -
@Nio_x said:
I realized that QtCreator loads MinGW DLLs that comes with Qt SDK instead of my own MinGW distro, and it may be root of the problem.
That's what I think too. Do not mix MinGW versions. Use the same one to build all DLLs in your app (this means you should use the version in the Qt SDK).
Or, at the very least, you must verify that your two MinGW versions are compatible.
but program doesn't crash as in release version. I am totally confused.
There are two possible reasons for this:
- A Debug version does more checks than a Release version. The Debug version might detect a problem that your Release version didn't notice. In this case, it is a good thing that the program crashes, because it informs you that there's a problem. The Release version could run for a while, corrupting memory without anybody realizing. Eventually, it could still crash... or even worse, corrupt your data.
- The Debug version and Release version have different memory layouts. Therefore, they don't crash in the same place.
-
@Nio_x said:
How can I tell QtCreator to use my MinGW libs?
When you select your MinGW compiler, Qt Creator will automatically use its libs.
By the way, do you use Qt in your project?
Finally, make sure that MinGW and Qt are not in your PATH. That tends to cause problems.
-
@Nio_x said:
It seems i need qmake.exe for last MinGW version. Where can i get one? Screenshot.
What version is that?
Could you just use Qt's version of MinGW to build your whole project?