View Full Version : Problems to compile (Unicode)
valy12
9th April 2010, 13:16
Hello,
i'm new in QT and i don't know many things about it so i need your help ^^
i'm trying to compile the library "wiiyourself" with QT but i have few problems. it runs on visual c++ but not on QT.
the principal problem is "error: cannot convert 'const char*' to 'const TCHAR*' ..."
i have heard that it's about Unicode wich isn't support by QT but how can i solve it?
(excuse my language i'm not english :s )
Thanks!
kuzulis
9th April 2010, 13:38
1. What use function WinApi?
To solve this problem - see the source code in Qt4 and look where macros type QT_WA ;)
toutarrive
9th April 2010, 14:20
i have heard that it's about Unicode wich isn't support by QT but how can i solve it?
Qt does support Unicode coding, it's even a foundation of QString!
TCHAR is a typedef from Microsoft which can be expand to the following:
#ifdef UNICODE
typedef wchar_t TCHAR;
#else
typedef char TCHAR;
#endif
TCHAR is char when you compile for multi-byte and wchar_t for unicode.
it runs on visual c++ but not on QT
It should as it is a typedef from Microsoft.
"the principal problem is "error: cannot convert 'const char*' to 'const TCHAR*' ..."
It means that you are using , at least, one function which needs at least one const TCHAR* as an argument.
As far as i know , TCHAR is not defined in Qt so you have to do the proper conversion by yourself for those functions which needs this argument type.
borisbn
9th April 2010, 14:45
show us code, that brings "error: cannot convert 'const char*' to 'const TCHAR*' ..."
valy12
9th April 2010, 15:13
i can't use winapi, it's for a school project and i have to use qt...
i tried tu put in my code the definition of UNICODE that you give me but it has errors at the same place : cannot convert 'const char*' to 'const wchar_t*' in initialization
i give you 2 examples of fonctions wich give errors :
const TCHAR* wiimote::ButtonNameFromBit [16] = { _T("Left") , _T("Right"), _T("Down"), _T("Up"), _T("Plus") , _T("??") , _T("??") , _T("??") , _T("Two") , _T("One") , _T("B") , _T("A") , _T("Minus"), _T("??") , _T("??") , _T("Home") };
WARN(_T("couldn't create sample thread!"));
toutarrive
9th April 2010, 16:03
You are mixing Qt type and Microsoft type in your code, hence the error you get since you haven't surely done the necessary conversion.
const TCHAR* wiimote::ButtonNameFromBit [16] = { _T("Left") , _T("Right"), _T("Down"), _T("Up"), _T("Plus") , _T("??") , _T("??") , _T("??") , _T("Two") , _T("One") , _T("B") , _T("A") , _T("Minus"), _T("??") , _T("??") , _T("Home") };
That is an array of 16 pointers to const TCHAR.
How do your use this array in your code?
valy12
11th April 2010, 11:37
well, the librarie "wiiyourself " was already written by another one, if ou want to see it : http://wiiyourself.gl.tter.org/
doesn't matter how well the fonctions are coded, i just want to use it. how can i change the code to be Qt type on this example ??
Thanks
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.