天天看點

QT編譯錯誤:Project ERROR: This example requires Qt to be configured with -opengl desktop

學習QT場景視圖,對一個Boxes的例子比較感興趣,于是去編譯學習,結果編譯不能通過(使用的是QT5.12):

Project ERROR: This example requires Qt to be configured with -opengl desktop

QT編譯錯誤:Project ERROR: This example requires Qt to be configured with -opengl desktop

我嘗試在*.pro檔案中加入 -opengl desktop,不管用!

在知乎上查到:

“-opengl desktop”隻是一個configure的選項,編譯Qt庫時設定的。

或者你說像5.4預編譯的qt-opensource-windows-x86-msvc2013_opengl-5.4.2.exe?5.5中預設使用了“-opengl dynamic”了。

看來隻能重新編譯一遍QT的源代碼來獲得了~(對此我後來進行了嘗試

編譯QT源碼配置關于OpenGL的支援選項說明如下(QT5.12版本 configure -h截圖):Linux環境預設是支援 -opengl desktop的

QT編譯錯誤:Project ERROR: This example requires Qt to be configured with -opengl desktop

回到家,我又重新安裝了QT4.8.6以及QT Creater4.2.2,這下就可以檢視Boxes例子了,直接編譯成功!

QT編譯錯誤:Project ERROR: This example requires Qt to be configured with -opengl desktop
QT編譯錯誤:Project ERROR: This example requires Qt to be configured with -opengl desktop