Jump to content

Error

Featured Replies

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!

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.

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

  • Author

i did <iostream>not #include<iostream.h>

i used <stdlib>, <process> amongst others

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?

  • Author
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.

Do you have #include before <iostream>? Because that wasn't very obvious from your post...

  • Author

Thanks all for the suggestions but the problem was with the compiler..i changed it and now its working..

Archived

This topic is now archived and is closed to further replies.

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.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.