[Solved] MSVC 2012 with Addin: Can't find Qt DLLs when starting project
-
Here is a problem I encountered along with a solution, should anyone else come across it:
My project was working fine, then I checked out another branch, switched back after a while and when I tried to start the project, I got the error "The program can't start because Qt5Cored.dll is missing from your computer.".
I'm using Visual Studio 2012 Update 3 with the latest Qt Addin, v1.2.2.
In order to get rid of it, I had to remove the ".vcxproj.user" file from Visual Studio. Unfortunately I don't have these under version control so I can't say for sure what was in there that made it trip up. But I looked through the property pages in MSVS, especially "Debug", before deleting the file and couldn't detect any changes.
-
Marcus,
the *.user files should normally not go into version control, since these contain your local working copy settings of your compiler. (same as the *.pro.user files in Qt Creator)Removing this file, probably caused your compiler to go through the setup procedure again, and re-establishing the link to Qt5Cored.dll.
-
To clarify: the .user files are indeed not under version control. But it happens, also on my colleagues machines, that Visual Studio decides it cannot find Qt DLLs from one app launch to the user. Only closing VS, deleting these files and starting VS again will get rid of this error.
-
Well, in my case VS 2012 insisted on creating a broken myproject.vcxproj.user. For some strange reason, on the first project I ported from Qt4/VS2010 to Qt5/VS2012, it had worked, on the second project it consistently failed. Thanks to this post, I was able to repair the .user - file manually. The working version looks like this:
@<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" >
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<QTDIR>C:\Qt\Qt5.2.0\5.2.0\msvc2012</QTDIR>
<LocalDebuggerEnvironment>PATH=$(QTDIR)\bin;"$(QTDIR)\bin;$(PATH)</LocalDebuggerEnvironment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<QTDIR>C:\Qt\Qt5.2.0\5.2.0\msvc2012</QTDIR>
<LocalDebuggerEnvironment>PATH=$(QTDIR)\bin;"$(QTDIR)\bin;$(PATH)</LocalDebuggerEnvironment>
</PropertyGroup>
</Project>@while the broken version looks like this:
@<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" >
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerEnvironment>PATH=$(QTDIR)\bin;"$(QTDIR)\bin;$(PATH)</LocalDebuggerEnvironment>
<QTDIR>C:\Qt\Qt5.2.0\5.2.0\msvc2012</QTDIR>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerEnvironment>PATH=$(QTDIR)\bin;"$(QTDIR)\bin;$(PATH)</LocalDebuggerEnvironment>
<QTDIR>C:\Qt\Qt5.2.0\5.2.0\msvc2012</QTDIR>
</PropertyGroup>
</Project>@The relevant change seems is the order of the QTDIR and the LocalDebuggerEnvironment Tags which makes sense since QTDIR is used in the LocalDebuggerEnvironment. Now the interesting question would be how this error happens?
Yes I know I could avoid this problem by setting QTDIR in my environment, but I don't want to do that on purpose (my typical target system doesn't have that environment variable set either). -
@Batox, Just a rough guess:
You could probably set the path of QTDIR in Visual Studio. (Project options) Leave the LocalDebuggerEnvironment as it is. But that way it "should" find the dll.(My installation is in german, so my paths are probably not relevant to your setup)