如果VisualStudio2026升级到最新版本,Qt5.15.X编译遇到错误,解决方案

xingyun86 9小时前 314

今天手滑更新了一下VisualStudio2026,结果qt编译发现报错

D:\Qt.Static.SSL\5.15.2\include\QtCore/qvector.h(960): error C3861: 'stdext': identifier not found

D:\Qt.Static.SSL\5.15.2\include\QtCore/qvector.h(960): error C2065: 'stdext': undeclared identifier

D:\Qt.Static.SSL\5.15.2\include\QtCore/qlist.h(915): error C3861: 'stdext': identifier not found

D:\Qt.Static.SSL\5.15.2\include\QtCore/qlist.h(915): error C2065: 'stdext': undeclared identifier

D:\Qt.Static.SSL\5.15.2\include\QtCore/qvarlengtharray.h(109): error C3861: 'stdext': identifier not found


真的头大,一直以解决问题自居的我,居然也会对这种棘手没有上下兼容的问题产生一些郁闷。

废话不多说,直接上解决方案。

俗话说蛇打七寸,它的七寸在哪里呢?

在这里:

#  define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N) stdext::make_checked_array_iterator(x, size_t(N)) // Since _MSC_VER >= 1500

修改方法:

#  define QT_MAKE_CHECKED_ARRAY_ITERATOR_OLD(x, N) x // Since _MSC_VER >= 1500

修改后,保存。

注意:此方法有投机取巧的方法,做QT产品化的慎用!

×
打赏作者
最新回复 (0)
查看全部
全部楼主
返回