Runtime "No disk in drive" errors
-
My app has a QTreeview using QFileSystemModel. My computer has a number of USB drives with no media inserted. When I run the app from within Qt Creator, either in debug or release mode, all is good. However, when I run the executable outside Creator I get multiple "No disk in drive" errors. I can replicate this behavior with the Dir View example.
I am running Qt 5.5.1 and MSVC2013_64bit on a Windows 10 PC.
Any advice on how to work around this behavior would be greatly appreciated.
-
Hi,
When you ran your application outside Qt Creator, did you deploy it properly ?
-
3 DLLs only ? Looks suspicious because you should not be able to run your application because of the missing platform plugin. You should run windeployqt, that will grab all necessary Qt dependencies.
-
I ran windeployqt and it added Qt5Svg.dll. However, this did not solve my problem.
C:\Qt\Qt5.5.1\5.5\msvc2013_64\bin>windeployqt "C:\Program Files\Winnow"
C:\Program Files\Winnow\winnow.exe 64 bit, release executable
Adding Qt5Svg for qsvgicon.dll
Direct dependencies: Qt5Core Qt5Gui Qt5Widgets
All dependencies : Qt5Core Qt5Gui Qt5Widgets
To be deployed : Qt5Core Qt5Gui Qt5Svg Qt5Widgets
Warning: Cannot find Visual Studio installation directory, VCINSTALLDIR is not set.
Qt5Core.dll is up to date.
Qt5Gui.dll is up to date.
Updating Qt5Svg.dll. -
I ran windeployqt and it added Qt5Svg.dll. However, this did not solve my problem.
C:\Qt\Qt5.5.1\5.5\msvc2013_64\bin>windeployqt "C:\Program Files\Winnow"
C:\Program Files\Winnow\winnow.exe 64 bit, release executable
Adding Qt5Svg for qsvgicon.dll
Direct dependencies: Qt5Core Qt5Gui Qt5Widgets
All dependencies : Qt5Core Qt5Gui Qt5Widgets
To be deployed : Qt5Core Qt5Gui Qt5Svg Qt5Widgets
Warning: Cannot find Visual Studio installation directory, VCINSTALLDIR is not set.
Qt5Core.dll is up to date.
Qt5Gui.dll is up to date.
Updating Qt5Svg.dll.I also tried copying my exe file "Winnow.exe" to the Qt bin folder, where all the dll's reside. I still get the same error. If I work past the error messages for each "No disk in drive" error then my app works just fine with just the original 3 dll's I listed.
-
Are you doing anything special or simply setting the QFileSystemModel on the QTreeView is enough to trigger that ?
-
Are you doing anything special or simply setting the QFileSystemModel on the QTreeView is enough to trigger that ?
Nothing special. As I mentioned, I get the same result with the Dir View example. However, I am continuing to explore your suggestion about deployment. I am working on figuring out what VCINSTALLDIR should be set to. I do not have a license for Visual Studio. I forget what I ended up downloading to get the VC compiler, but as a result I do have Microsoft Visual Studio 12.0. I'm guessing if I set VCINSTALLDIR correctly then windeployqt may install something I need.
Okay, this worked I think. I set VCINSTALLDIR = C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC and windeployqt ran without errors or warnings. My app seems to be working now.
Thanks very much for getting me pointed in the right direction!!
-
It turns out this topic is not solved. I found another reference to the problem: "I'm using QDir().isReadable to check if a drive is readable. In the Qt Creator it runs fine, but when I run the exe it keeps giving me errors" here.
The temporary solution to set HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows\ErrorMode = 2 is working.
Is there a known work around in Qt?
-
Did you test the code provided in the same answer ?