Re: Weird behavior / bug(?) with VC++ Studio 2005 (Beta 2)

Tech-Archive recommends: Fix windows errors by optimizing your registry



You have UNICODE defined. When you compile with Unicode, Windows API
functions that take strings resolve to their Unicode variants, which have a
'W' suffix. They then require Unicode strings as parameters.

Either change your strings to be Unicode strings (constants should have an L
prefix), or change your compile options to use "multi-byte character sets".
--
David

"David F" <David-White@xxxxxxxxxxxxx> wrote in message
news:uRns%23ElcFHA.2696@xxxxxxxxxxxxxxxxxxxxxxx
>I am getting the following 2 error messages from the compiler:
>
> f:\development\projects 2005\fc\fc.cpp(296) : error C2664: 'wsprintfW' :
> cannot convert parameter 1 from 'LPSTR' to 'LPWSTR'
>
> Types pointed to are unrelated; conversion requires
> reinterpret_cast, C-style cast or function-style cast
>
>
>
> f:\development\projects 2005\fc\fc.cpp(373) : error C2664:
> 'FindFirstFileW'
> : cannot convert parameter 1 from 'const char *' to 'LPCWSTR'
>
> Types pointed to are unrelated; conversion requires
> reinterpret_cast, C-style cast or function-style cast
>
>
> My code does not have "wsprintfW" & "FindFirstFileW" !
> What I do have is "wsprintf" & "FindFirstFile".
>
> Anybody heard about such behavior of the C++ compiler?
>
> Thanks,
> David
>
>


.



Relevant Pages

  • Re: L macro
    ... ..cpp file, it could compile. ... "Alexander Nickolov" wrote: ... Coding everything in UNICODE wide characters ... So, if you want to use Unicode UTF-16 strings in your app, you should put ...
    (microsoft.public.vc.language)
  • Re: Multilanguage support for CEdit
    ... converts the strings back and forth. ... It will still compile OK, but cs won't be Unicode just because you recompile ... pBuf is a unicode string. ...
    (microsoft.public.vc.mfc)
  • Re: How to check variables for uniqueness ?
    ... characters is the sequence SS. ... is simply capitalizing strings. ... The fact that case mapping in English /is/ simple is neither here not ... That is a fair criticism of the Unicode position. ...
    (comp.lang.java.programmer)
  • Re: Dangerous behavior of CString
    ... If I'm reading a data file or serial port or something, if the raw data are multibyte but the compilation is Unicode or vice-versa, then sometimes the converting constructors in CString are convenient. ... I did not actually write code like this; in fact I was pretty careful always to use the _T macro with any literal strings. ... But it does the conversion using the current 8-bit code page, which is not what I want. ...
    (microsoft.public.vc.mfc)
  • Re: Help please
    ... i would like to provide "CSimString" class code because the settings ... I agree with Tom that first step is project clean and rebuild all. ... with a Unicode string, ... Consider that VS2005 strings are Unicode by default, ...
    (microsoft.public.vc.mfc)