[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

libstdc++: where is ios_base?



Hello,

Don't know if this is the proper forum, but I try anyway.

Say I am trying to compile the folling code on a frozen Debian:

	#include <string>
	#include <iostream>

	using namespace std;

	int main()
	{
		cout.setf(ios_base::hex, ios_base::basefield);
			for (int i=int('a'); i <= int('z'); i++)
					cout << "'" << char(i) 
					     << "' = " << i << endl;
	}

The compiler will halt with:

	g++ -O2 -Wall -c ex1.cpp
	ex1.cpp: In function `int main()':
	ex1.cpp:8: `ios_base' undeclared (first use this function)
	ex1.cpp:8: (Each undeclared identifier is reported only once
	ex1.cpp:8: for each function it appears in.)
	ex1.cpp:8: parse error before `::'
	make: *** [ex1.o] Error 1
	(3 of 7):  `ios_base' undeclared (first use this function)

Now I have been poking around the include files, and I do find references
to ios::hex instead of ios_base::hex. Is this because an older version of
libstd++ is used, or am I including not enough headers?

Hope someone knows an answer,

Regards,

-- 
Renald Buter                    | Centre for Science and Technology Studies
EMail: buter@cwts.leidenuniv.nl | University of Leiden
Phone: +31 - 71 527 3904        | P.O. Box 9555, 2300 RB Leiden
FAX  : +31 - 71 527 3911        | The Netherlands

  Upon seeing the box was too small, 
  Schrodinger's Elephant breathed a sigh of relief.


Reply to: