简体   繁体   中英

wchar_t clashing with unsigned short

I am updating our libraries to a newer version and have hit a compilation error:

ClassName &ReturnClass::FuncName(wchar_t *,size_t)' : member function already defined or declared

However it is previously defined as this:

ClassName &ReturnClass::FuncName(unsigned short *,size_t)'

And we have wchar_t as a typedef of unsigned short which seems to be causing the issue.

I have tried using the compiler option wchar_t but that causes masses of errors in the library when it sees the typedef .

I am using nmake to build the code in Windows and MSDEV as a code editor.

Has anyone seen this sort of thing before? How did you solve it?

Okay, the issue has been resolved. The required compiler option was /Zc:wchar_t and not just `wchar_t', although that did resolve the initial issue.

I wsa under the impression that the '/Zc' bit was MS specific and was not required when directly using the clr compiler - DOH!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM