想在VS2017中使用Qt,但是安裝完qt插件後,報錯。
報錯日誌:
2018/12/9 21:46:54 - Microsoft VSIX Installer
2018/12/9 21:46:54 - -------------------------------------------
2018/12/9 21:46:54 - vsixinstaller.exe version:
2018/12/9 21:46:54 - 15.8.3253
2018/12/9 21:46:54 - -------------------------------------------
2018/12/9 21:46:54 - Command line parameters:
2018/12/9 21:46:54 - D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\vsixinstaller.exe,/appidinstallpath:D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe,/skuName:Community,/skuVersion:15.0.28010.2048,/appidname:Microsoft Visual Studio Community 2017,/culture:zh-CN,/noep,C:\Users\pikachu\AppData\Local\Temp\VSIXz1izwxdy.vsix
2018/12/9 21:46:54 - -------------------------------------------
2018/12/9 21:46:54 - Microsoft VSIX Installer
2018/12/9 21:46:54 - -------------------------------------------
2018/12/9 21:46:55 - Initializing Install...
2018/12/9 21:46:55 - 擴展詳細信息...
2018/12/9 21:46:55 - Identifier : QtVsTools.13121978-cd02-4fd0-89bd-e36f85abe16a
2018/12/9 21:46:55 - Name : Qt Visual Studio Tools
2018/12/9 21:46:55 - Author : The Qt Company Ltd.
2018/12/9 21:46:55 - Version : 2.2.2
2018/12/9 21:46:55 - Description : The Qt Visual Studio Tools allow developers to use the standard development environment without having to worry about any Qt-related build steps or tools.
2018/12/9 21:46:55 - Locale : en-US
2018/12/9 21:46:55 - MoreInfoURL : http://www.qt.io/
2018/12/9 21:46:55 - InstalledByMSI : False
2018/12/9 21:46:55 - SupportedFrameworkVersionRange : [4.6,)
2018/12/9 21:46:55 -
2018/12/9 21:46:55 - SignatureState : Unsigned
2018/12/9 21:46:55 - 支持的產品 :
2018/12/9 21:46:55 - Microsoft.VisualStudio.Pro
2018/12/9 21:46:55 - Version : [15.0]
2018/12/9 21:46:55 - Microsoft.VisualStudio.Premium
2018/12/9 21:46:55 - Version : [15.0]
2018/12/9 21:46:55 - Microsoft.VisualStudio.Ultimate
2018/12/9 21:46:55 - Version : [15.0]
2018/12/9 21:46:55 - Microsoft.VisualStudio.Community
2018/12/9 21:46:55 - Version : [15.0]
2018/12/9 21:46:55 -
2018/12/9 21:46:55 - 引用 :
2018/12/9 21:46:55 - 系統必備 :
2018/12/9 21:46:55 - -------------------------------------------------------
2018/12/9 21:46:55 - Identifier : Microsoft.VisualStudio.Component.CoreEditor
2018/12/9 21:46:55 - Name : Visual Studio core editor
2018/12/9 21:46:55 - Version : [15.0.26208.0,16.0)
2018/12/9 21:46:55 -
2018/12/9 21:46:55 - -------------------------------------------------------
2018/12/9 21:46:55 - Identifier : Microsoft.VisualStudio.Component.VC.CoreIde
2018/12/9 21:46:55 - Name : Visual Studio C++ core features
2018/12/9 21:46:55 - Version : [15.0.26208.0,16.0)
2018/12/9 21:46:55 -
2018/12/9 21:46:55 - -------------------------------------------------------
2018/12/9 21:46:55 - Identifier : Microsoft.VisualStudio.Component.VC.Tools.x86.x64
2018/12/9 21:46:55 - Name : VC++ 2017 v141 toolset (x86,x64)
2018/12/9 21:46:55 - Version : [15.0.26208.0,16.0)
2018/12/9 21:46:55 -
2018/12/9 21:46:55 - 簽名詳細信息...
2018/12/9 21:46:55 - Extension is not signed.
2018/12/9 21:46:55 -
2018/12/9 21:46:55 - System.Runtime.InteropServices.COMException (0x80070490): 找不到元素。 (異常來自 HRESULT:0x80070490)
在 Microsoft.VisualStudio.Setup.Configuration.ISetupConfiguration2.GetInstanceForPath(String path)
在 VSIXInstaller.LocationBasedSKU..ctor(String appidInstallPath, String appidName, Version vsVersion, String edition, String rootSuffix)
在 VSIXInstaller.LocationBasedSKU..ctor(String appidInstallPath, String appidName, Version vsVersion, String edition, String rootSuffix, IntPtr alternateUserToken)
在 VSIXInstaller.ExtensionService.GetInstallableData(String vsixPath, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData)
在 VSIXInstaller.App.Initialize(Boolean isRepairSupported)
在 VSIXInstaller.App.Initialize()
在 System.Threading.Tasks.Task`1.InnerInvoke()
在 System.Threading.Tasks.Task.Execute()
有什麼辦法呢?
重裝吧
重裝以後,再安裝Qt插件
啓動VS2017,打開一個工程
開始調試,又報錯
warning C4819: 該文件包含不能在當前代碼頁(936)中表示的字符。請將該文件保存爲 Unicode 格式以防止數據丟失 (編譯源文件 filetreemodel.cpp)
百度一番解決
然後發現這一行代碼始終編譯不過
this->lastModified = fileInfo.lastModified().toString("yyyy年MM月dd日");
去掉中文後編譯通過
this->lastModified = fileInfo.lastModified().toString("yyyyMMdd");
只是這樣顯示效果不好
就這樣,VS2017成功的跑起來了Qt程序。
代碼: GitHub - Bulbasaur