Testing Code Containing Typedef of wchar_t

Question:

My source code contains typedef int wchar_t;.  How do I avoid getting a compile error in the S0000009.c file when I build an environment?

Answer:

This problem occurs because the test harness #includes stdlib.h which contains:
 

#ifndef _WCHAR_T
#define _WCHAR_T
typedef unsigned int wchar_t;
#endif

 

It can be fixed for your environment by going to Tools | Options | C/C++ (tab) | Compiler/Preprocessor (sub-tab) and adding _WCHAR_T to the defined variable list.  



Article ID: 1510
Last updated: 2019-11-13
Revision: 5
VectorCAST -> C++ Unit Testing -> Testing Code Containing Typedef of wchar_t
https://kb.vector.com/entry/1510/