Archived Forum Post

Index of archived forum posts

Question:

Chilkat VC++ Libraries: wchar_t as a built-in type?

Jun 13 '14 at 08:46

Ok, I can see the problem now, your library is compiled with /Zc:wchar_t where as my code is using /Zc:wchar_t- which is why I was getting linking issues. Is there a possibility to have a version of the library compiled with that flag turned off as well?


Answer

To solve the problem, do this:

  1. Using a text editor capable of doing a "Replace in Files" (such as in Visual Studio), replace all occurances of "wchar_t" with "ck_wchar_t" in the Chilkat header (.h) files.
  2. In your application's source code, add the following typedef prior to including any Chilkat headers:
typedef __wchar_t ck_wchar_t;

Finally, when you use "wchar_t" in your program, cast the type to prevent warnings/errors. Your program should link OK with the Chilkat lib. For example:

        CkEmailW email;
        const wchar_t *v = (const wchar_t *) email.version();