Include <wchar.h> after defining the types, not before.