c++charctype

isblank() is not recognized


It seems that the isblank() function of the cctype header does not recognized by the gcc compiler. I use code blocks and I get:

error: 'isblank' was not declared in this scope

I checked the gcc cctype header and found the following lines:

   81 #ifdef __GXX_EXPERIMENTAL_CXX0X__
   82 
   83 #ifdef _GLIBCXX_USE_C99_CTYPE_TR1
   84 
   85 #undef isblank
   86 
   87 namespace std
   88 {
   89   using ::isblank;
   90 } // namespace std
   91 
   92 #endif // _GLIBCXX_USE_C99_CTYPE_TR1
   93 
   94 #endif // __GXX_EXPERIMENTAL_CXX0X__
   95 
   96 #endif

How can I get isblank() to work? and what are these lines basically about?

UPDATE

My code:

#include <iostream>
#include <cctype>

using namespace std;

int main()
{
    char ch;

    cout << "\n\n\n Enter a character:  ";
    cin >> ch;

    if (isblank(ch))
        cout << "\n blank characters.";

    cout << "\n\n\n";
}

code blocks version: 16.01 GCC/G++ compiler and GDB debugger from TDM-GCC (version 4.9.2, 32 bit, SJLJ).


Solution

  • OK,

    Thanks all,

    I get it to work by clearing the checked compiler flag:

    settings -> compiler settings -> compiler flags -> -std=c++14h

    However, I am sure this will affect some other programs. I remember I set this flag because some other features had not worked without it.

    Using other compilers is another option as noted in the comments like MinGW64 or MSVC++.

    This link could be useful to read:

    Thanks again.