Qt使用MFC ATL的问题

尘小陌 2019-09-05 09:28:17
用Qt写DShow方面的东西,由于要用到CComPtr智能指针,所以在Qt中添加了atlbase.h头文件,但是编译的时候,出现以下4条错误提示
是Qt不能使用atlbase,还是需要要哪里修改设置?

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\atldef.h:665: error: expected constructor, destructor, or type conversion before '(' token
#define ATLPREFAST_SUPPRESS(x) __pragma(warning(push)) __pragma(warning(disable: x))
^

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\atldef.h:666: error: expected constructor, destructor, or type conversion before '(' token
#define ATLPREFAST_UNSUPPRESS() __pragma(warning(pop))
^

C:\Qt\Qt5.11.1\Tools\mingw530_32\i686-w64-mingw32\include\mbstring.h:11: error: expected '}' before end of line

C:\Qt\Qt5.11.1\Tools\mingw530_32\i686-w64-mingw32\include\mbstring.h:11: error: expected declaration before end of line
...全文
764 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
尘小陌 2019-09-05
  • 打赏
  • 举报
回复
引用 1 楼 赵4老师 的回复:
仅供参考:
#include <afxpriv.h>
#include <stdio.h>
char str[3]="汉";
wchar_t ws[2];
int main() {
    USES_CONVERSION;
    swprintf(ws,L"%s",A2W(str));
    printf("%04hX\n",(unsigned short)ws[0]);
    return 0;
}
//6C49
//
呃,你回答的和我问的,不是一个问题吧。。。。
赵4老师 2019-09-05
  • 打赏
  • 举报
回复
仅供参考:
#include <afxpriv.h>
#include <stdio.h>
char str[3]="汉";
wchar_t ws[2];
int main() {
    USES_CONVERSION;
    swprintf(ws,L"%s",A2W(str));
    printf("%04hX\n",(unsigned short)ws[0]);
    return 0;
}
//6C49
//
赵4老师 2019-09-05
  • 打赏
  • 举报
回复
建议微调相关头文件的#include顺序。
尘小陌 2019-09-05
  • 打赏
  • 举报
回复
引用 3 楼 赵4老师 的回复:
A2W是属于ATL吧。 要想正确地使用A2W,得事先调用USES_CONVERSION 没准你想正确地调用ATLPREFAST_*,也得事先调用个啥。 仅供参考,参考不了不是我的责任。
我不是用A2W,我是想用CComPtr和CComQIPtr这两智能指针
赵4老师 2019-09-05
  • 打赏
  • 举报
回复
A2W是属于ATL吧。 要想正确地使用A2W,得事先调用USES_CONVERSION 没准你想正确地调用ATLPREFAST_*,也得事先调用个啥。 仅供参考,参考不了不是我的责任。

24,860

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧