当前位置:网站首页>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();
}
参考网站:
边栏推荐
- Jackson解析JSON详细教程
- Qml控件:ComboBox
- 什么是_GLIBCXX_VISIBILITY(default)
- Mysql多对多关系,分组拼接把多个数据查询到一条数据上
- TCP three handshakes and four waves
- AUTOSAR从入门到精通100讲(七十八)-AUTOSAR-DEM模块
- SM integration is as simple as before, and the steps are clear (detailed)
- ARFoundation从零开始5-AR图像跟踪
- Visual Basic .Net 如何获取命令参数
- Getting started with arfoundation tutorial 10- plane detection and placement
猜你喜欢

Unity3D - 物体太远看不见的问题

JS (foreach) return cannot end the function solution

How mongodb inserts, deletes and updates documents

Open source Huizhi creates the future | the openeuler sub forum of 2022 open atom global open source summit was successfully held

Mysql的自连接和联合查询

Webrtc audio anti weak network technology (Part 2)

时间序列分析的表示学习时代来了?

Architecture analysis of three-tier project and parameter name injection of construction method

Young freshmen yearn for more open source | here comes the escape guide from open source to employment!

ARFoundation入门教程7-url动态加载图像跟踪库
随机推荐
tmux随笔
2021-10-23
Learn the first program of database
手写学生管理系统
What if excel is stuck and not saved? The solution of Excel not saved but stuck
AttributeError: ‘module‘ object has no attribute ‘create_connection‘
Let you understand several common traffic exposure schemes in kubernetes cluster
ODOO开发教程之透视表
AttributeError: ‘module‘ object has no attribute ‘create_ connection‘
三层项目的架构分析及构造方法的参数名称注入
Jackson parsing JSON detailed tutorial
ARFoundation从零开始8-Geospatial API(地理空间)开发
力扣------对奇偶下标分别排序
缓存穿透、缓存击穿、缓存雪崩以及解决方法
Activity workflow table structure learning
ARFoundation入门教程7-url动态加载图像跟踪库
6.3 references
6.2 function-parameters
pytorch学习笔记
Numpy Foundation