使用包含Stdafx.h的类时,Qt程序编译错误

时间:2018-03-15 03:40:36

标签: qt stdafx.h

当我添加一些设备oem类(使用stdafx.h)时,我的qt应用程序出现编译错误。

"Error  1   error C1189: #error :  Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]  

从我从互联网上找到的内容,我将我的项目属性设置为"在共享DLL中使用MFC"解决错误,但当我再次编译时,它会产生一些其他错误:

Error   1   error C2664: 'LONG SCardConnectW(SCARDCONTEXT,LPCWSTR,DWORD,DWORD,LPSCARDHANDLE,LPDWORD)' : cannot convert argument 2 from 'const char *' to 'LPCWSTR'

Error   2   error C2440: '=' : cannot convert from 'int8 *' to 'LPCWSTR'    

Error   3   error C2679: binary '=' : no operator found which takes a right-hand operand of type 'LPCWSTR' (or there is no acceptable conversion)

Error   4   error C2664: 'LONG SCardStatusW(SCARDHANDLE,LPWSTR,LPDWORD,LPDWORD,LPDWORD,LPBYTE,LPDWORD)' : cannot convert argument 2 from 'int8 *' to 'LPWSTR'

我尝试设置使用Unicode字符集并使用多字节字符集,但没有解决问题。

1 个答案:

答案 0 :(得分:0)

不要混用MFC和Qt - 这不起作用。您需要重构OEM内容或您自己的软件才能使用Qt / MFC。