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
我尝试在*.pro文件中加入 -opengl desktop,不管用!
在知乎上查到:
“-opengl desktop”只是一个configure的选项,编译Qt库时设置的。
或者你说像5.4预编译的qt-opensource-windows-x86-msvc2013_opengl-5.4.2.exe?5.5中默认使用了“-opengl dynamic”了。看来只能重新编译一遍QT的源代码来获得了~(对此我后来进行了尝试:https://www.cnblogs.com/MakeView660/p/10416924.html)
编译QT源码配置关于OpenGL的支持选项说明如下(QT5.12版本 configure -h截图):Linux环境默认是支持 -opengl desktop的
![](https://img2018.cnblogs.com/blog/1012444/201902/1012444-20190215122831785-784497144.png)
回到家,我又重新安装了QT4.8.6以及QT Creater4.2.2,这下就可以查看Boxes例子了,直接编译成功!
![](https://img2018.cnblogs.com/blog/1012444/201902/1012444-20190202210520090-1129305490.png)
![](https://img2018.cnblogs.com/blog/1012444/201902/1012444-20190202210815464-926166220.png)
希望大家能把自己的所学和他人一起分享,不要去鄙视别人索取时的贪婪,因为最应该被鄙视的是不肯分享时的吝啬。