在vs中使用qt

1.qt使用mfc

#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // some CString constructors will be explicit

// turns off MFC's hiding of some common and often safely ignored warning messages
#define _AFX_ALL_WARNINGS

#include          // MFC core and standard components
#include          // MFC extensions


#include         // MFC Automation classes



#ifndef _AFX_NO_OLE_SUPPORT
#include            // MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include              // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT

#include      // MFC support for ribbons and control bars
#include 

将上述代码拷贝到qt程序的.h文件中
同时项目属性->配置属性->常规->用mfc设置为Use MFC in a Shared DLL;

2.vs中qt去掉红线提示

https://blog.csdn.net/friendbkf/article/details/49641415
初次用VS进行Qt开发时,会遇到IDE提示找不到对应头文件的红线语法错误。但是编译运行一切正常。
这是因为编译环境include了正确的位置,但是IDE的语法检查器却没有包含对应的位置。
只需修改一下工程属性即可。
项目 - 属性 -VC++目录 - 包含目录,添加Qt的include文件夹路径之后,一切恢复正常,IDE的红线提示消失。
在vs中使用qt_第1张图片

你可能感兴趣的:(qt)