开发者

CTYPE issue during building dame

I am trying to build DAME. Environment details:

GCC - gcc version 4.4.2 (GCC) ANTLR - ANTLR Parser Generator Version 2.7.2

when i am trying to compile the following code snippet:

#include <functional>
#include <iomanip>

struct compare_without_case_char  : public std::binary_function<char, char, bool>
{
        const std::ctype<char>& ct ;

        compare_without_case_char (const std::ctype<char>& c = std::use_facet<std::ctype<char> > (std::locale::classic()))
                        : ct(c) {}

        bool operator() (char x, char y) const
        {
                return (ct.toupper(x) == ct.toupper(y)) ;
        }
} ;

Following error is coming:

test_ctype.cpp: In member function 'bool compare_without_case_char::operator()(char, char) const':
test_ctype.cpp:16: error: invalid use of incomplete type 'const struct std::ctype<char>'
/storage11/oracle/ANAND_BM/gcc-4.4.2/gcc_4_4_2_release/gcc-4.4.2_build/lib/gcc/spar开发者_运维技巧c-sun-solaris2.10/4.4.2/../../../../include/c++/4.4.2/bits/localefwd.h:115: error: declaration of 'const struct std::ctype<char>'
test_ctype.cpp:16: error: invalid use of incomplete type 'const struct std::ctype<char>'
/storage11/oracle/ANAND_BM/gcc-4.4.2/gcc_4_4_2_release/gcc-4.4.2_build/lib/gcc/sparc-sun-solaris2.10/4.4.2/../../../../include/c++/4.4.2/bits/localefwd.h:115: error: declaration of 'const struct std::ctype<char>'
In file included from /storage11/oracle/ANAND_BM/gcc-4.4.2/gcc_4_4_2_release/gcc-4.4.2_build/lib/gcc/sparc-sun-solaris2.10/4.4.2/../../../../include/c++/4.4.2/bits/locale_classes.h:809,
                 from /storage11/oracle/ANAND_BM/gcc-4.4.2/gcc_4_4_2_release/gcc-4.4.2_build/lib/gcc/sparc-sun-solaris2.10/4.4.2/../../../../include/c++/4.4.2/bits/ios_base.h:43,
                 from /storage11/oracle/ANAND_BM/gcc-4.4.2/gcc_4_4_2_release/gcc-4.4.2_build/lib/gcc/sparc-sun-solaris2.10/4.4.2/../../../../include/c++/4.4.2/iomanip:42,
                 from test_ctype.cpp:2:
/storage11/oracle/ANAND_BM/gcc-4.4.2/gcc_4_4_2_release/gcc-4.4.2_build/lib/gcc/sparc-sun-solaris2.10/4.4.2/../../../../include/c++/4.4.2/bits/locale_classes.tcc: In function 'const _Facet& std::use_facet(const std::locale&) [with _Facet = std::ctype<char>]':
test_ctype.cpp:11:   instantiated from here
/storage11/oracle/ANAND_BM/gcc-4.4.2/gcc_4_4_2_release/gcc-4.4.2_build/lib/gcc/sparc-sun-solaris2.10/4.4.2/../../../../include/c++/4.4.2/bits/locale_classes.tcc:107: error: incomplete type 'std::ctype<char>' used in nested name specifier
/storage11/oracle/ANAND_BM/gcc-4.4.2/gcc_4_4_2_release/gcc-4.4.2_build/lib/gcc/sparc-sun-solaris2.10/4.4.2/../../../../include/c++/4.4.2/bits/locale_classes.tcc:112: error: cannot dynamic_cast '* *(__facets + ((unsigned int)(((unsigned int)__i) * 4u)))' (of type 'const class std::locale::facet') to type 'const struct std::ctype<char>&' (target is not pointer or reference to complete type)

What is the real issue and how I can resolve it. Regards, Anand Kumar Keshri


The only problem here is that your compiler cannot find std::ctype. You have to #include the file containing it :

#include <locale>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜