Thread: ::wcstold has not been declared.

  1. #1
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587

    ::wcstold has not been declared.

    I'm getting more than 50 errors relating to standard headers, so something's REALLY messed up.

    Code:
    /usr/include/c++/4.5/cwchar|249|error: ‘::wcstold’ has not been declared|
    /usr/include/c++/4.5/cwchar|266|error: ‘__gnu_cxx::wcstold’ has not been declared|
    /usr/include/c++/4.5/tr1_impl/cwchar|50|error: ‘std::wcstold’ has not been declared|
    /usr/include/c++/4.5/i686-linux-gnu/bits/c++locale.h|52|error: ‘uselocale’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/c++locale.h|52|error: invalid type in declaration before ‘;’ token|
    /usr/include/c++/4.5/i686-linux-gnu/bits/c++locale.h|59|error: ‘__locale_t’ does not name a type|
    /usr/include/c++/4.5/i686-linux-gnu/bits/c++locale.h|66|error: ‘__c_locale’ does not name a type|
    /usr/include/c++/4.5/i686-linux-gnu/bits/c++locale.h||In function ‘int std::__convert_from_v(const int&, char*, int, const char*, ...)’:|
    /usr/include/c++/4.5/i686-linux-gnu/bits/c++locale.h|72|error: ‘__c_locale’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/c++locale.h|72|error: expected ‘;’ before ‘__old’|
    /usr/include/c++/4.5/i686-linux-gnu/bits/c++locale.h|97|error: ‘__old’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/c++locale.h|97|error: ‘__gnu_cxx::__uselocale’ cannot be used as a function|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|44|error: ‘pthread_t’ does not name a type|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|45|error: ‘pthread_key_t’ does not name a type|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|46|error: ‘pthread_once_t’ does not name a type|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|47|error: ‘pthread_mutex_t’ does not name a type|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|48|error: ‘pthread_mutex_t’ does not name a type|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|49|error: ‘pthread_cond_t’ does not name a type|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|118|error: ‘pthread_once’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|118|error: invalid type in declaration before ‘;’ token|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|119|error: ‘pthread_getspecific’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|119|error: invalid type in declaration before ‘;’ token|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|120|error: ‘pthread_setspecific’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|120|error: invalid type in declaration before ‘;’ token|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|122|error: ‘pthread_create’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|122|error: invalid type in declaration before ‘;’ token|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|123|error: ‘pthread_join’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|123|error: invalid type in declaration before ‘;’ token|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|124|error: ‘pthread_equal’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|124|error: invalid type in declaration before ‘;’ token|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|125|error: ‘pthread_self’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|125|error: invalid type in declaration before ‘;’ token|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|126|error: ‘pthread_detach’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|126|error: invalid type in declaration before ‘;’ token|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|127|error: ‘pthread_cancel’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|127|error: invalid type in declaration before ‘;’ token|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|128|error: ‘sched_yield’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|128|error: invalid type in declaration before ‘;’ token|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|130|error: ‘pthread_mutex_lock’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|130|error: invalid type in declaration before ‘;’ token|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|131|error: ‘pthread_mutex_trylock’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|131|error: invalid type in declaration before ‘;’ token|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|137|error: ‘pthread_mutex_unlock’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|137|error: invalid type in declaration before ‘;’ token|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|138|error: ‘pthread_mutex_init’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|138|error: invalid type in declaration before ‘;’ token|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|139|error: ‘pthread_mutex_destroy’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|139|error: invalid type in declaration before ‘;’ token|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|141|error: ‘pthread_cond_broadcast’ was not declared in this scope|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|141|error: invalid type in declaration before ‘;’ token|
    /usr/include/c++/4.5/i686-linux-gnu/bits/gthr-default.h|142|error: ‘pthread_cond_signal’ was not declared in this scope|
    ||More errors follow but not being shown.|
    ||Edit the max errors limit in compiler options...|
    ||=== Build finished: 50 errors, 0 warnings ===|
    Here's my code, but I really don't think it's the source of the problem.

    Code:
    #include <gmpxx.h>
    
    #include <fstream>
    #include <iostream>
    #include <set>
    #include <vector>
    
    using namespace std;
    
    ostream &out = cout;
    
    set<mpz_class> progression;
    
    int main()
    {
        mpz_class t = 1;
        int max_length = 3;
        int progression_length = 100;
    
        cout << "Progression Length: ";
        cin >> progression_length;
    
        cout << "Max Subsequence Length: ";
        cin >> max_length;
    
        // out << "Progression: ";
    
        for(int i = 1;i < progression_length;t += (i++))
        {
            progression.insert(t);
            // out << t << " ";
        }
    
        out << endl << "Subsequences: " << endl;
    
        for(int length = 2;length <= max_length;length++)
        {
            set<mpz_class> sub_seq;
    
            for(int d = 1;d <= 10;d++)
            {
                for(auto i = progression.begin();i != progression.end();i++)
                {
                    mpz_class next = *i + d;
    
                    sub_seq.insert(*i);
    
                    for(auto j = i;j != progression.end();j++)
                        if(*j > next)
                            break;
                        else if(*j == next)
                        {
                            next += d;
                            sub_seq.insert(*j);
                        }
    
                    if(sub_seq.size() < length)
                        sub_seq.clear();
                    else if(sub_seq.size() == length)
                        break;
                }
    
                if(sub_seq.size() < length)
                    sub_seq.clear();
                else
                    break;
            }
    
            if(sub_seq.size() == length)
            {
                out << "Subsequence of length " << length << ": ";
    
                for(auto i = sub_seq.begin();i != sub_seq.end();i++)
                    out << *i << " ";
    
                out << endl;
            }
            else
                out << "No subsequence of length " << length << " could be found." << endl;
        }
    
        return 0;
    }
    I'm compiling with GCC, using C++0x.

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Looks like you need to #include <wchar.h>

    wcstold(3) - Linux man page

  3. #3
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    Okay. I tried that, and the errors are the same.

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Something does appear to be very very odd here. If you start with just hello world and start adding things, what causes bad things?

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Wild guess from a C programmer working on learning C++.

    Try moving "#include <gmpxx.h>" after the standard C++ includes.

    Tim S.

  6. #6
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    Something is very, very wrong.

    Code:
    #include <iostream>
    
    int main() {return 0;}
    Gives exactly the same errors.

    It does the same with fstream, so I'm guessing there's a really messed up header related to streams.

    BTW, I'm using the standard GCC compiler from the Kubuntu repositories. It's version 4.5.

    I'm going to reinstall the packages and see if it helps.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 10-12-2006, 06:58 AM
  2. Check if is declared
    By maxorator in forum C++ Programming
    Replies: 11
    Last Post: 08-26-2005, 09:42 AM
  3. Declared Error
    By LloydUzari in forum C++ Programming
    Replies: 4
    Last Post: 08-06-2004, 08:36 PM
  4. declared row and column
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 10-16-2001, 11:55 AM