当前位置:网站首页>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();
}
参考网站:
边栏推荐
- 7.3-function-templates
- NumPy基础
- 关于servlet中实现网站的页面跳转
- 关于thymeleaf的配置与使用
- Is Huatai Securities an AA level securities company? How about this company? Is it safe to open an account?
- Northeast University Data Science Foundation (matlab) - Notes
- 缓存穿透、缓存击穿、缓存雪崩以及解决方法
- Use annotation test in idea
- Mysql的自连接和联合查询
- 2022年泰迪杯数据挖掘挑战赛C题方案及赛后总结
猜你喜欢

The method and detailed code of automatically pop-up and QQ group when players visit the website

Force deduction ----- sort odd and even subscripts respectively

Functions in MySQL statements

How to add a map to the legendary server

使用Jstack、Jconsole和jvisualvm进行死锁分析

How to add traffic statistics codes to the legendary Development Zone website

What if excel is stuck and not saved? The solution of Excel not saved but stuck

Google gtest事件机制

How does word view document modification traces? How word views document modification traces

Deep learning brush a bunch of tricks of SOTA
随机推荐
[file download] easyexcel quick start
WPS insert hyperlink cannot be opened. What should I do if I prompt "unable to open the specified file"!
Create a mindscore environment in modelars, install mindvision, and conduct in-depth learning and training (Huawei)
How does excel filter out the content you want? Excel table filtering content tutorial
Pytorch learning notes
Lenovo Savior r7000+ add ssd+ copy and partition the information of the original D disk to the new SSD
2021-10-23
C how to realize simple factory mode
Arfoundation starts from scratch 3- create an arfoundation project
Youxuan database failed to start and reported network error
About the configuration and use of thymeleaf
VirtualBox has expanded the capacity of virtual hard disk (without modifying the original data)
Functions in MySQL statements
[wechat applet] swiper slides the page, and the left and right sides of the slider show part of the front and back, showing part of the front and back
Google GTEST event mechanism
"Invisible Bridge" built in the free trade economy: domestic products and Chinese AI power
2022年SPSSPRO认证杯数学建模B题第二阶段方案及赛后总结
How to make the characters in the photos laugh? HMS core video editing service one click smile function makes people smile more naturally
How does WPS use smart fill to quickly fill data? WPS method of quickly filling data
Mysql把查询到的结果集按指定顺寻进行排序