天天看點

QT no Qt platform plugin could be initialized./Qt: error lnk1158 無法運作rc.exe

Qt5.12.3版本,用MSVC2017(64bit),發現建立一個新的項目,能夠正常編譯,但運作是出現了一個錯誤(如下圖所示)。看了很多部落格,說的是因為安裝新的軟體,導緻環境的改變造成的。

QT no Qt platform plugin could be initialized./Qt: error lnk1158 無法運作rc.exe

我試過其他的方法也沒有用。當我把msvc2017中的plugins加入系統變量中時就能夠運作了,然而我删除這個變量之後依然能夠正常運作。使得我感到莫名其妙。如果哪位大神知道,還望指點。

這裡貼出環境變量和程式的圖檔。

QT no Qt platform plugin could be initialized./Qt: error lnk1158 無法運作rc.exe
QT no Qt platform plugin could be initialized./Qt: error lnk1158 無法運作rc.exe

參考于https://forum.qt.io/topic/90293/could-not-find-or-load-the-qt-platform-plugin-windows-in/20

QT no Qt platform plugin could be initialized./Qt: error lnk1158 無法運作rc.exe

在安裝新的MSVC2017之後用MSVC2015編譯QT項目,出現Qt: error lnk1158 無法運作rc.exe錯誤。

之後查找資料在PATH環境中添加rc.exe的(C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64;(每個人的可能有些許差異,而且32bit的也與64bit的不同))路徑,重新開機電腦後就能正常運作了。

在添加環境變量時記得每個路徑之間加英文的分号";"。

QT no Qt platform plugin could be initialized./Qt: error lnk1158 無法運作rc.exe

繼續閱讀