Unsolved Compiling Existing QT application with VS2015X86 QT 5.6 having errors
-
I have already QT application. Whenever QT has been release we download those latest binaries and start compiling our application. Still now we have compiled from Qt 5.1.1 to till date. But Qt 5.6 not providided binaries for VS2012 . So We tried on VS2015 with QT 5.6. But not all are compiling.
Below is the errors
warning C4477: 'swscanf' : format string '%c' requires an argument of type 'wchar_t *', but variadic argument 1 has type 'char *'
note: consider using '%hc' in the format string
note: consider using '%Tc' in the format string
note: consider defining _CRT_STDIO_ISO_WIDE_SPECIFIERS if C99 standard semantics is required
warning C4477: 'swscanf' : format string '%c' requires an argument of type 'wchar_t *', but variadic argument 1 has type 'unsigned char *'
note: consider using '%hc' in the format string
note: consider using '%Tc' in the format string
note: consider defining _CRT_STDIO_ISO_WIDE_SPECIFIERS if C99 standard semantics is required
error C2440: '=': cannot convert from 'const wchar_t [19]' to 'WCHAR *'
..\wm\src\Registry.cpp(225): note: Conversion from string literal loses const qualifier (see /Zc:strictStrings)Seems something has broken in VS2015 . Any suggestion on this?
-
Hi
It seems they added extra checking to VS 2015 RTM
http://blogs.msdn.com/b/vcblog/archive/2015/06/22/format-specifiers-checking.aspx -
This I saw, but How to easily to change the existing application, need a good approach. otherwise i need to switch code between compilers.
-
@Narasimman said:
Seems something has broken in VS2015 .
It's actually the other way around. They started to give you warnings when your code is broken. Previously the code worked (or seem to) in silently undefined way.
Any suggestion on this?
I guess since you're going to touch that code anyway you could take the opportunity and use these warnings to fix it.
The first warning you posted means you're passing a narrow character string to a function expecting a wide character string, so a simple fix:swscanf("foo", ...
->swscanf(L"foo", ...
. If the param comes from somewhere you need to convert it first.Can you post a sample code that triggers the warnings?