Jump to content

Recommended Posts

Posted

I was working on C++ and encountered following error

"Fatal iostream.h 19: Error directive : Must use C++ for the type iostream"

can anyone tell me what does this mean!

Posted

Supposedly that you tried to compile the program with a C compiler (or linker) rather than a C++ one. That's just a guess, though.

Posted

What header files did you include? Did you do something bad like #include <iostream.h> rather than <iostream> ?

Posted

OK then. A couple other possibilities:

 

Did you name your file "myprogram.c" rather than "myprogram.cc" (or "myprogram.cpp" or "myprogram.c++")? Some compilers know that .c files are to be compiled as if they are written in C rather than C++.

 

Do you have an unterminated extern "C" { (i.e., missing close brace) lurking around somewhere, including in the headers files you #included before the #include <iostream> directive?

Posted
OK then. A couple other possibilities:

 

Did you name your file "myprogram.c" rather than "myprogram.cc" (or "myprogram.cpp" or "myprogram.c++")? Some compilers know that .c files are to be compiled as if they are written in C rather than C++.

 

Do you have an unterminated extern "C" { (i.e., missing close brace) lurking around somewhere, including in the headers files you #included before the #include <iostream> directive?

no such error done by me.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.