Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SerialPortInfoWinBase.cpp _T() cannot convert 'const char*' to 'LPCWSTR #30

Closed
itas109 opened this issue Jun 7, 2020 · 1 comment
Closed
Labels

Comments

@itas109
Copy link
Owner

itas109 commented Jun 7, 2020

Describe the bug
SerialPortInfoWinBase.cpp _T() cannot convert 'const char*' to 'LPCWSTR

SerialPortInfoWinBase.cpp:93:107: error: cannot convert 'const char*' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'LONG RegQueryValueExW(HKEY, LPCWSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD)'

RegQueryValueEx(hDevKey, _T("PortName"), NULL, NULL, (BYTE*)portName, &dwCount);

Desktop (please complete the following information):

  • OS: Win7 Ultimate 64bit
  • Compiler: QT 5.6.3 MinGW 4.9.2 (32-bit)
  • Version: 4.0.3.200429
@itas109 itas109 added the bug label Jun 7, 2020
@itas109
Copy link
Owner Author

itas109 commented Jun 7, 2020

RegQueryValueEx(hDevKey, _T("PortName"), NULL, NULL, (BYTE*)portName, &dwCount);

MinGW 4.9.2 (32-bit) file tchar.h

#ifdef _UNICODE
...
#define __T(x) L##x
...
#else
...
#define __T(x) x
...
#endif

but, QT defined UNICODE( not _UNICODE)

so, denfine _UNICODE can solve this problem

itas109 added a commit that referenced this issue Aug 30, 2020
Signed-off-by: itas109 <itas109@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant