C++ 在Visual Studio 2019中使用Qt时出错

C++ 在Visual Studio 2019中使用Qt时出错,c++,visual-studio,qt,C++,Visual Studio,Qt,我正在尝试在VisualStudio2019中使用Qt。我在VS中安装了扩展名“Qt-VS-tools”,并添加了我的Qt路径。我在VS中创建了一个新的QtGUI应用程序项目,没有更改任何内容,但我得到了错误 == Qt Visual Studio Tools version 2.4.2 Initialized in: 14169,6 msecs Main (UI) thread: 292,38 msecs TestQT.vcxproj: background build F

我正在尝试在VisualStudio2019中使用Qt。我在VS中安装了扩展名“Qt-VS-tools”,并添加了我的Qt路径。我在VS中创建了一个新的QtGUI应用程序项目,没有更改任何内容,但我得到了错误

  == Qt Visual Studio Tools version 2.4.2

   Initialized in: 14169,6 msecs
   Main (UI) thread: 292,38 msecs

TestQT.vcxproj: background build FAILED!
TestQT.vcxproj: background build FAILED!
TestQT.vcxproj: background build FAILED!
作为Qt VS tools的输出,如果我尝试构建这个项目,我会得到

1>------ Rebuild All started: Project: TestQT, Configuration: Debug x64 ------
1>Reading Qt configuration (C:\Qt\5.14.0\msvc2017_64\bin\qmake.exe)
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018: The "GetVarsFromMakefile" task failed unexpectedly.
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018: System.ArgumentException: An item with the same key has already been added.
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018:    at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018:    at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018:    at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018:    at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018:    at InlineCode.GetVarsFromMakefile.Execute() in c:\Users\tom\AppData\Local\Temp\2zkteh3y.0.cs:line 71
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
1>Done building project "TestQT.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
1>----已启动全部重建:项目:TestQT,配置:Debug x64------
1> 正在读取Qt配置(C:\Qt\5.14.0\msvc2017\U 64\bin\qmake.exe)
1> C:\Users\tom\AppData\Local\qtmbuild\qt_vars.targets(246,5):错误MSB4018:“GetVarsFromMakefile”任务意外失败。
1> C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5):错误MSB4018:System.ArgumentException:已添加具有相同键的项。
1> C:\Users\tom\AppData\Local\qtmbuild\qt_vars.targets(246,5):错误MSB4018:at System.ThrowHelper.ThrowArgumentException(ExceptionResource)
1> C:\Users\tom\AppData\Local\qtmbuild\qt_vars.targets(246,5):错误MSB4018:at System.Collections.Generic.Dictionary`2.Insert(TKey-key,TValue-value,Boolean-add)
1> C:\Users\tom\AppData\Local\qtmbuild\qt_vars.targets(246,5):错误MSB4018:at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1源,Func`2键选择器,Func`2元素选择器,IEqualityComparer`1比较器)
1> C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5):错误MSB4018:at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source,Func`2 keySelector,Func`2 elementSelector)
1> C:\Users\tom\AppData\Local\qtmbuild\qt_vars.targets(246,5):错误MSB4018:位于C:\Users\tom\AppData\Local\Temp\2zkteh3y.0.cs:第71行中的InlineCode.GetVarsFromMakefile.Execute()
1> C:\Users\tom\AppData\Local\QtMsBuild\qt_vars.targets(246,5):错误MSB4018:位于Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ItaskeExecutionHost.Execute()
1> C:\Users\tom\AppData\Local\qtmbuild\qt_vars.targets(246,5):错误MSB4018:位于Microsoft.Build.BackEnd.TaskBuilder.d_u26.MoveNext()
1> 已完成构建项目“TestQT.vcxproj”--失败。
=========全部重建:0成功,1失败,0跳过==========

对于这个新手的问题,我很抱歉,但我已经在谷歌上搜索了几个小时…

安装rev.09版本的扩展。如果您需要更多信息,请在评论中提供错误报告和解决方案。14解决了这个问题。我可以将5.14与VS2019一起使用,昨天发布了Qt
5.14.0
,所以可能扩展还不支持它。您可以尝试安装较旧的Qt版本(例如
5.12.6
),并检查它是否工作良好这就是解决方案。谢谢:)太棒了,你很好。我仍然面临这个问题,报告错误:-|