当前位置:网站首页>MFC集成qt验证及问题处理
MFC集成qt验证及问题处理
2022-07-29 05:08:00 【longlongway2012】
MFC集成QT
MFC集成qt网上已经有很多例子,我在这里只是记录下我验证过程中遇到的问题,以便同样问题的人不再碰壁。
1. 单独创建一个mfc dll 无法导出
QWinWidget类和 QmfcApp类中使用QT_QTWINMIGRATE_EXPORT导出,但总是输出的不全,后来自己定义独立的导出而不用原定义的宏
#ifdef QGUI_EXPORTS
#define QGUI_API __declspec(dllexport)
#else
#define QGUI_API __declspec(dllimport)
#endif
2. 创建MFC程序后,他引用Qt文件就报错
错误 C2061 语法错误: 标识符“n”
原来MFC每个cpp文件中都对new进行了重载:
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
从而导致一下代码中 new的执行调用错误:
QT_TRY {
while(current != to) {
new (current) T(*reinterpret_cast<T*>(src));
++current;
++src;
}
3. 生成QT项目后,无法运行
生成后需要使用windeployqt进行发布,但我发布后仍然无法运行,参考别的博客,原来是qtplugin需要配置环境变量
错误如下:
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
添加环境变量:
QT_QPA_PLATFORM_PLUGIN_PATH=%QTDIR%/plugins
4. mfc使用多字节时输入框乱码:
默认使用宽字节,mfc输入框没问题,当改为多字节就出现乱码,后来发现,可以不适用qMfcApp::run,消息也可以正确路由:
int CMFCQtDlgTestApp::Run()
{
MainQTFrame mainUI;
mainUI.show();
//return QMfcApp::run(this);
return CWinAppEx::Run();
}
参考网站:
边栏推荐
- VirtualBox has expanded the capacity of virtual hard disk (without modifying the original data)
- Arfoundation starts from zero 9-ar anchor
- Qml类型:State 状态
- AttributeError: ‘module‘ object has no attribute ‘create_ connection‘
- Lenovo Savior r7000+ add ssd+ copy and partition the information of the original D disk to the new SSD
- 2021-10-23
- ARFoundation入门教程10-平面检测和放置
- Raspberry pie 4B + Intel neural computing stick (stick2) +yolov5 feasibility study report
- ARFoundation从零开始3-创建ARFoundation项目
- 自贸经济中架起的“隐形桥梁”:国货精品与中国AI力量
猜你喜欢
2022年泰迪杯数据挖掘挑战赛C题方案及赛后总结
Northeast University Data Science Foundation (matlab) - Notes
Force deduction ----- sort odd and even subscripts respectively
向往的开源之多YOUNG新生 | 从开源到就业的避坑指南来啦!
学习数据库的第一个程序
[file download] easyexcel quick start
Getting started with arfoundation tutorial 10- plane detection and placement
The latest tank battle 2022 - Notes on the whole development -2
深度学习刷SOTA的一堆trick
ARFoundation从零开始8-Geospatial API(地理空间)开发
随机推荐
QML定制TabBar
Northeast University Data Science Foundation (matlab) - Notes
ARFoundation从零开始9-AR锚点(AR Anchor)
pytorch学习笔记
源码编译pytorch坑
学习数据库的第一个程序
NumPy基础
Deadlock analysis using jstack, jconsole, and jvisualvm
What if the computer cannot open excel? The solution of Excel not opening
Mysql语句中的函数
ARFoundation入门教程10-平面检测和放置
传奇如何一台服务器配置多个版本微端更新
传奇服务端如何添加地图
Getting started with arfoundation tutorial 10- plane detection and placement
6.3 references
Qml控件:ComboBox
What servers are needed to build mobile app
How to solve the problem of configuring the progress every time Office2010 is opened?
SQL log
Lenovo Savior r7000+ add ssd+ copy and partition the information of the original D disk to the new SSD