这问题出现在我在Qt5.6.0 msvc2013 32bit上添加获取CPU序列号、显卡MAC地址、硬盘序列号时,编译时出现error: C2440: “默认参数”: 无法从“const wchar_t [1]”转换为“BSTR”,Qt5.12 msvc2015 64bit上编译通过。刚开始以为时版本问题,然后在网上搜到答案。
解决方法:
在pro工程中
win32: QMAKE_CXXFLAGS_RELEASE -= -Zc:strictStrings
win32: QMAKE_CFLAGS_RELEASE -= -Zc:strictStrings
win32: QMAKE_CFLAGS -= -Zc:strictStrings
win32: QMAKE_CXXFLAGS -= -Zc:strictStrings
然后qmake 一下即可。
原创: https://blog.csdn.net/stevenkoh/article/details/82839601