www.digitalmars.com         C & C++   DMDScript  

c++ - Problems with iostream.h (bugs?)

reply "Alexis Golzman" <agolzman ciudad.com.ar> writes:
Hi, I'm trying to compile this little program:

#include <iostream.h>

void main()
{
cout << "Hello World!\n";
}

But I get the following errors:

sc test.cpp -cpp -Ae -Ju -ms -o+time -3 -a2 -c -I. -otest.obj
Error: C:\PROGTOOLS\DM\BIN\..\include\iostream.h(443): 'istream::getline' is
already defined
Error: C:\PROGTOOLS\DM\BIN\..\include\iostream.h(452): 'istream::get' is
already defined
Error: C:\PROGTOOLS\DM\BIN\..\include\iostream.h(468): 'istream::operator
' is already defined
Error: C:\PROGTOOLS\DM\BIN\..\include\iostream.h(470): 'istream::operator
' is already defined
Fatal Error: C:\PROGTOOLS\DM\BIN\..\include\iostream.h(518): too many errors Lines Processed: 599 Errors: 5 Warnings: 0 Build failed What am I doing wrong? I'm using version 8.25 of the compiler. I used the DOS Executable options. Thanks in advance for your help. Season's Greetings, Alexis. http://www.RestYourEyes.com
Dec 25 2001
parent reply "Walter" <walter digitalmars.com> writes:
The problem is -Ju. -Ju is for old K&R C programs, it causes char
overloading in C++ to fail. -Walter

"Alexis Golzman" <agolzman ciudad.com.ar> wrote in message
news:a09hk1$217r$1 digitaldaemon.com...
 Hi, I'm trying to compile this little program:

 #include <iostream.h>

 void main()
 {
 cout << "Hello World!\n";
 }

 But I get the following errors:

 sc test.cpp -cpp -Ae -Ju -ms -o+time -3 -a2 -c -I. -otest.obj
 Error: C:\PROGTOOLS\DM\BIN\..\include\iostream.h(443): 'istream::getline'
is
 already defined
 Error: C:\PROGTOOLS\DM\BIN\..\include\iostream.h(452): 'istream::get' is
 already defined
 Error: C:\PROGTOOLS\DM\BIN\..\include\iostream.h(468): 'istream::operator
' is already defined
Error: C:\PROGTOOLS\DM\BIN\..\include\iostream.h(470): 'istream::operator
' is already defined
Fatal Error: C:\PROGTOOLS\DM\BIN\..\include\iostream.h(518): too many
errors
 Lines Processed: 599  Errors: 5  Warnings: 0
 Build failed

 What am I doing wrong?

 I'm using version 8.25 of the compiler. I used the DOS Executable options.

 Thanks in advance for your help.

 Season's Greetings,
 Alexis.
 http://www.RestYourEyes.com
Dec 25 2001
parent "Alexis Golzman" <agolzman ciudad.com.ar> writes:
Now I changed the option to -J (chars are unsigned) and it works OK.

Thanks!

Alexis.

| The problem is -Ju. -Ju is for old K&R C programs, it causes char
| overloading in C++ to fail. -Walter
Dec 26 2001