On Wed, 18 Sep 2013 16:58:46 +0200 Frédéric Bron wrote:
FB> Since I moved to mingw-w64 cross compiler instead of mingw32, I get
FB> the following error in 64 bits mode only:
FB> include/wx-2.9/wx/msw/winundef.h:39:20: error: cannot convert 'LPCTSTR
Where is this header included from? If you include it directly from your
code, I can't really recommend anything other than defining UNICODE. If
this header is included implicitly by wxWidgets, then it should be already
compiled with UNICODE defined and the only reason for this not happening
that I see is that wxUSE_UNICODE is not correctly defined as 1.
FB> I read thinks about adding -D_UNICODE or -DUNICODE:
You should never have to define those for wxWidgets needs (you may want to
define them for your Win32 code not using wxWidgets though).
FB> -D_UNICODE does not help
Not surprising, it affects the CRT only. The problem here is with Windows
functions which are only affected by UNICODE.
FB> -DUNICODE helps but I then have an issue later in the compilation
FB> process in a file totally independent of wxWidgets:
FB> error: cannot convert 'const char*' to 'LPCWSTR {aka const wchar_t*}'
FB> for argument '1' to 'WINBOOL SetCurrentDirectoryW(LPCWSTR)'
FB> This is due to -DUNICODE which changes SetCurrentDirectoryA to
FB> SetCurrentDirectoryW (I use SetCurrentDirectory in my code) and me who
FB> uses a normal std::string as argument (however I cannot make this part
FB> of code dependent of wx).
This kind of situations is precisely why we don't require defining neither
_UNICODE nor UNICODE when using wxWidgets. But wxUSE_UNICODE must be
defined and we do define both _UNICODE and UNICODE ourselves in this case
(see wx/platform.h).
FB> Why should I add -DUNICODE when wx-config --cxxflags does not say it?
You shouldn't.
FB> Why no issue when targetting 32bit platform?
FB> Why no issue when using mingw32 and not mingw-w64?
No idea. There seems to be a bug somewhere but I don't know where, please
check if you can find it with the information from the above.
FB> What is the recommended practice to avoid such things?
Normally everything should just work, so there is nothing to avoid...
Clearly, this is not what happens to you in practice, but I really don't
know why, sorry.
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/