【问题标题】:Qt program compile error when using a class which includes Stdafx.h使用包含 Stdafx.h 的类时 Qt 程序编译错误
【发布时间】:2018-03-15 03:40:36
【问题描述】:

当我添加一些设备 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 字符集和使用多字节字符集,但没有解决问题。

【问题讨论】:

    标签: qt stdafx.h


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-20
      • 1970-01-01
      • 2012-11-29
      • 2010-09-30
      • 2012-07-28
      • 1970-01-01
      • 1970-01-01
      • 2013-04-17
      相关资源
      最近更新 更多