0

This is my header file,

sample.h

#pragma

#ifndef BASETYPES
#define BASETYPES

typedef char16_t WCHAR

#endif

This is my C code,

sample.c

WCHAR *name;
int main() {
}

The above header was initially used by only C++ code. Now I have a C code to compile which uses the same header file.

When I compile the C code using GCC, I am getting the following error,

"error G5688306C: unknown type name char16_t"

I read this this and it looks like it isnt really a bug.

Is there any work around or any fix to the problem I am facing? Please suggest.

Shaik Syed Ali
  • 3,359
  • 3
  • 17
  • 22

1 Answers1

2

char16_t is not a built in C type. It was introduced by C++11 in the uchar.h header. Using C++11 features with GCC is enabled with -std=c++11.

If you can't use C++11, you must use another type instead.
wchar_t or uint16_t may be useful.

Romen
  • 1,617
  • 10
  • 26