Damon Cortesi's blog

Musings of an entrepreneur.

Configuring Visual C++ for Unicode

| Comments

error C2664: FormatMessageA : Cannot convert parameter from LPWSTR to LPSTR

I was getting this error on a brand new project to take over a user’s session in Windows (w00t!) in which I was reusing code. Turns out it was a Unicode problem - after adding UNICODE to the Preprocessor Definitions in the project properties (Configuration Properties -> C/C++ -> Preprocesser), the project compiled with no errors.

It’s little things like these that is probably common sense for most c++ users, but when I switch between PERL, PHP, C++, and WMI on an almost-daily basis I tend to forget.

Comments