I'm getting more than 50 errors relating to standard headers, so something's REALLY messed up.
Here's my code, but I really don't think it's the source of the problem.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 ===|
I'm compiling with GCC, using C++0x.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; }



LinkBack URL
About LinkBacks


