This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

g++ conformance question


Hi,

If I have addressed this question to the wrong address, please either
return it to me or forward it to the correct person.

I am trying to write a program that uses wcin and wcout to read in and
print out wchar_t type (actually 2 byte unicode characters).  A very
simple program looks like the following:

#include <iostream> 
#include <cwchar>

using namespace std;

int main()
{
   wchar_t uni;
   std::cout << "Enter a two byte value: ";
   wcin >> uni;

   wcout << uni << std::endl;

   return 0;
}

When I try to compile this, the compiler is complaing that wcin (and
wcout) are undeclared.  I sent a similar question to the ACCU's list,
and have been told this code will compile on Borland C++ Builder 5. I
have tried to compile this using both g++ 2.95.x and on a recently
installed g++ 3.0.3, with the same result.

So, do i need to compile while linking something into the compile step?

I've noticed in the documentation that there is something called the
ios_base.h header which appeared to tie the wcin, wcout, etc operators
together.  If I type a "locate ios_base" at my command prompt (on a Unix
box), I get no return (yet, for the 3.0.3 implementation on my Linux
box, the ios header is there, and I still cannot compile a program
contain wcin or wcout).

Your help (and this could be pointing me to the correct documentation!)
would be greatly appreciated.

Many thanks.

ciao!
greg.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]