Problem in running the exe file
-
Hello to all,
I have created my application in the debug mode and runs without errors getting the right results. But when I am trying to run the created exe file I get a message saying that QtCored4.dll is missing from my pc. I am using windows 7 (64 bit), visual studio 2010 and Qt 4.7.3 added in vs2010. What I should do to run the exe file without using vs? Is it necessery to run my application in release mode, or I could do this task just with debug mode?
Thanks
-
All dependencies (DLLs), including the Qt libraries, have to be placed in one of these "locations":http://goo.gl/FNXv9
bq. * The directory where the executable module for the current process is located.
- The current directory.
- The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
- The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
- The directories listed in the PATH environment variable.
-
Well I have run my application in release mode and I have set the bin directory in my path variable. So I have created the exe file, and I can run it without using the vs2010. But when I am trying to run the exe in an other machine I cannot open it and I get an error saying that it cannot find the QtCored4.dll.I must say that in this second machine I have already set the bin directory in my path variable.So when I create a project in this machine I can run the exe file properly. Do you know what is going wrong? And how I could run the created exe in other machines without having problems?
-
bq. run my application in release mode
bq. it cannot find the QtCored4.dll
One of these statements is incorrect.
-
Well I have managed to run my exe file by copying all the dll's files in the same directory with exe file. So I managed to run the exe in two different machines, which both have the same version of Qt. I want to know, if I tried to run the exe in a PC which will not have installed the Qt, then could I take my results?Or is it neccesery to run the exe on pc's with Qt installed?
-
[quote author="jk_mk" date="1309682805"]Well I have managed to run my exe file by copying all the dll's files in the same directory with exe file. So I managed to run the exe in two different machines, which both have the same version of Qt. I want to know, if I tried to run the exe in a PC which will not have installed the Qt, then could I take my results?Or is it neccesery to run the exe on pc's with Qt installed?
[/quote]
-
To distribute the application on a system without Qt installed (or without Qt dlls in path) you copy the .dll files into the same folder as the .exe file, there is one dll for each Qt module you used into your project (ex: QtCore4.dll, QtGui4.dll, etc) and you also need the run-time dlls of the compiler you use (in your case you need the vs2010 redist to be installed)
But you messed up something (see Alexandr's post) because if you built (and copied) the "release" .exe then it shouldn't ask for the QtCore d 4.dll (this one is the debug built dll) and you will need the QtCore4.dll for release .exe (without that 'd' in the name) - just be careful what you build and what you copy and you should be fine.
-
The places for dlls have been nicely summarized by this post ( see also above ).
[quote author="Lukas Geyer" date="1309625643"]All dependencies (DLLs), including the Qt libraries, have to be placed in one of these "locations":http://goo.gl/FNXv9
bq. * The directory where the executable module for the current process is located.
- The current directory.
- The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
- The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
- The directories listed in the PATH environment variable.[/quote]
Certainly you can copy every time the exe and the dll to the desired directories. But with vs2010 you may want to create a "Setup and Deployment" project. If you add a project in vs you should have such a possibility under other projects.
As Zlatomir pointed out, you are using a debug dll with a release compilation? That should not happen.
One last important thing for distribution of your project's results are the license conditions.
-
Well I fixed the problem of QtCore4.dll, as I build my application in release mode from scratch.
I have created the exe file in vs2010 (windows7 64 bit) and now I am trying to run it in a pc (windowsXP 32 bit) with vs2008.As I can understand it is not necessery to install Qt in the second pc. I copy all the bin folder including the dll's and the exe file in the second pc. I have installed vs2010 redist in the second pc.But when I double click on the exe I get a message saying that msvcp100.dll is missing from my pc. I downloaded and copy this dll in the folder, and I have tried to run again the exe. But now I get a message saying that msvcpr100.dll is missing from my pc. I download this dll again but again I cannot run the exe.
Am I missing something? -
You are missing the VS2010 specific dlls. That is why I was already adding:
[quote author="koahnig" date="1309689725"]
Certainly you can copy every time the exe and the dll to the desired directories. But with vs2010 you may want to create a "Setup and Deployment" project. If you add a project in vs you should have such a possibility under other projects.
[/quote]The only way I know to handle this is the "Setup and Deployment" project. You need to consult the microsoft help text for this.
I was once doing it for VS2005. Under VS2005 you somehow detect all the dlls you need. For VS2010 you need to find your way through. I doubt that is close to VS2005 procedure.