why is this boroken?

#if _GLIBCXX_HAVE_WCHAR_H
#include <wchar.h>
#endif

#ifndef _GLIBCXX_CWCHAR
#define _GLIBCXX_CWCHAR 1

// Need to do a bit of trickery here with mbstate_t as char_traits
// assumes it is in wchar.h, regardless of wchar_t specializations.
#ifndef _GLIBCXX_HAVE_MBSTATE_T
extern "C"


fatal error: wchar.h: No such file or directory

I tried reinstalling code blocks,the compiler,system restore,tried Microsoft VS.
I am using win7.
Last edited on
I wonder if <cwchar> would work.
How?I can write any basic program,but is still shows me that.
Go to the CB compiler settings and make sure it is set to be using the latest standard. GCC otherwise defaults to a time before wchar.h existed.

I assume you have the latest version of CB, which comes with a decent GCC. If not, it might be worth your time to upgrade your GCC == download and install the latest and then go to the CB compiler settings to use the newly-installed compiler instead of the one that came preinstalled.

BTW, a word of warning: don’t touch mbstate_t. It is specifically declared as a piece of compiler-specific magic. It is probably worth your time to find a different way to do what you want.

Hope this helps.
Topic archived. No new replies allowed.