繁体   English   中英

在 Visual Studio 2019 中使用 Qt 时出错

[英]Error while using Qt in Visual Studio 2019

我正在尝试在 Visual Studio 2019 中使用 Qt。我在 VS 中安装了扩展“Qt VS tools”并添加了我的 Qt 路径。 我在 VS 中创建了一个新的 Qt Gui Application 项目。 没有改变任何我得到错误

  == 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 工具的输出,如果我尝试构建这个项目,我会得到

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 ==========

我很抱歉这个新手问题,但我现在用谷歌搜索了几个小时......

https://download.qt.io/development_releases/vsaddin/2.4.2/安装 rev.09 版本的扩展,如果你想了解更多信息,这里是错误报告和评论中的解决方案https://bugreports.qt.io/browse /QTVSADDINBUG-722

Rev. 14 解决了这个问题。 我可以在 VS2019 中使用 5.14

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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