简体   繁体   中英

Qt application does not execute inside Qt Creator

I am developing a cross platform Qt audio application. On Linux, the application runs without any problems, but on Windows the application do not execute when started from the Qt Creator.

When running with the Release configuration (or without debugging), Qt Creator simply says:

"The program has unexpectedly finished."

If I run with the Debug configuration (or debugging), Qt Creator says:

"During startup program exited with code 0x0000135."

Since googling for the error did not helped at all, I decided to copy every .exe and .dll (needed Qt libraries - like QtCore - included) needed by my application to an empty directory and the application executed perfectly, just like under Linux.

So, I'm guessing this is a problem with the Windows not finding the dll's needed by my application.

This problem appeared last weekend when I upgraded my system to Windows 8. Previously (with Windows 7) I had no such problem.

Does anyone know a solution that do not involves modifying the build parameters (which are stored at the file .user)?

I don't want to do this because this file will be invalidated when I test the application under Linux, and I don't want to keep to versions of it.

Just solved it!

Probably a bug in Qt Creator.

My project has 4 sub-projects inside: main.exe, a core.dll, side.dll, external.dll.

main.exe needs core.dll and side.dll
core.dll needs external.dll

Since main.exe needs only core.dll and side.dll, I have not added a reference to external.dll. Qt Creator should be smart enough to detect its dependencies and add them accordingly (well, at last this is what happens under Linux).

Since it don't detect correctly the dependencies, it does not build the correctly PATH environment variable when I try to run main.exe from Qt Creator, causing the problems.

Solved it by adding the following lines at my main.pro file:

win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../external/release/ -lexternal
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../external/debug/ -lexternal

#INCLUDEPATH += $$PWD/../external
win32: DEPENDPATH += $$PWD/../external

Note: I changed the modules names for better understanding.

I guess it is because the path in executing environment doesn't contain path for Qt-DLLs any more. Go to Project Settings and check the PATH variable in "Debugging and Execution" Settings In my case eg: C:\\QtSDK\\mingw\\bin;C:\\QtSDK\\Desktop\\Qt\\4.8.1\\mingw\\lib;...Other paths...

regards.

The problem is definitely with some missing dll(s)! I've found out that when I put dll's directly into folder(for instance png3.dll) with executable and then running it from qt creator it will run!! What I did: in your output directory(where executable lies) you open your executable(double click), Windows shows dll names that are missing. You find them and copy directly into the folder. Then run app from Qt creator! You should succeed if dlls are suitable. After that you try removing dlls from the exec folder and run app through qt creator till the moment it throws error again. This way you find the missing dll. After that you add the path to dll in qt creator "projects" settings in "build environment" into "Path" variable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM