Qt program compile error when using a class which includes Stdafx.h

161 Views Asked by At

I'm getting a compile error with my qt application when i added some device oem classes(which uses stdafx.h).

"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]  

From what i found from the internet, i set my project properties to "Use MFC in a Shared DLL" to solve the error but when i compile again it generates some other errors:

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'

i tried to set to Use Unicode Character Set and Use Multibyte Character Set but doesn't solve the issue.

1

There are 1 best solutions below

0
Jens On

Do not mix MFC and Qt - this will not work. You need to either refactor the OEM stuff or your own software to use Qt / MFC.