Click to See Complete Forum and Search --> : compile error


June 30th, 1999, 10:12 AM
I get
"error C2664: 'MessageBoxW':cannot convert parameter 2 from 'char [5]' to 'const unsigned short *'"

when using ::messageBox.

If I comment out the following two lines then the message box will work fine.

#define UNICODE
#define _UNICODE

but if I leave the comments in and compile, then I get:

error C2440: 'initializing'
error C2664: 'SetCommandText'

both saying that they can't convert a parameter.

What gives???

TIA, Woody
wmckay@asmr.com

chiuyan
June 30th, 1999, 10:28 AM
you are building a unicode app, which means each char is 2 bytes (a short), but you are trying to pass in a char* which is only a one byte char. These types are not compatible.

If you wish to use char* (one byte char's), then do not build a unicode build. If you want to build a unicode version, then you are going to have to use WCHAR's or some other 2 byte data type to store your chars in.

HTH
--michael

June 30th, 1999, 10:31 AM
What's your active configuration? If it's Unicode, then you might want to change it to Debug.

Go to Menu itme Build\Set Active Configuration.., change it to Debug and try the build again.