当前位置:网站首页>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();
}
参考网站:
边栏推荐
- ARFoundation从零开始8-Geospatial API(地理空间)开发
- How to solve the problem of configuring the progress every time Office2010 is opened?
- sql日志
- Pivot table of odoo development tutorial
- Mysql的自连接和联合查询
- What if the computer cannot open excel? The solution of Excel not opening
- MySQL many to many relationship, grouping and splicing to query multiple data to one data
- 什么是_GLIBCXX_VISIBILITY(default)
- Getting started with solidity
- 最新坦克大战2022-全程开发笔记-1
猜你喜欢

Sparksql inserts or updates in batches and saves data to MySQL

What if the office prompts that the system configuration cannot run?

Qml控件:ComboBox

2022年SPSSPRO认证杯数学建模B题第二阶段方案及赛后总结

Northeast University Data Science Foundation (matlab) - Notes

The person who goes to and from work on time and never wants to work overtime has been promoted in front of me

How mongodb inserts, deletes and updates documents

学习数据库的第一个程序

最新坦克大战2022-全程开发笔记-2

On AspectJ framework
随机推荐
C 语言手写 QQ-AI 版
Raspberry pie 4B + Intel neural computing stick (stick2) +yolov5 feasibility study report
What if the office prompts that the system configuration cannot run?
How to solve the problem of configuring the progress every time Office2010 is opened?
Is Huatai Securities an AA level securities company? How about this company? Is it safe to open an account?
Qt版的贪食蛇游戏项目
Learn the first program of database
js(forEach)出现return无法结束函数的解决方法
How does excel filter out the content you want? Excel table filtering content tutorial
C how to realize simple factory mode
【[第一次写博客]Uda课程中的P控制器实现说明】
How mongodb inserts, deletes and updates documents
2022年泰迪杯数据挖掘挑战赛C题方案及赛后总结
Qml类型:State 状态
tmux随笔
Arfoundation starts from scratch 8-geospatial API (geospatial) development
[config] configure array parameters
The latest tank battle 2022 - full development notes-3
Mysql多对多关系,分组拼接把多个数据查询到一条数据上
QML定制TabBar