You are here:

C++/fatal error in c++


QUESTION: #include<iostream.h>
void m1(int *a){
a = new int[20];

a[0] = 100;

void m2(int *a){

  a = new int[20];

  a[0] = 200;

  delete[] a;


int main()
 int *a = new int [20];
 a[0] = 20;






return 0;
in the above code i am getting fatal error during compilation : "Must use c++ for type iostream" my file has extension c++ still the error.pls help. thanx

ANSWER: <iostream.h> is not a standard C++ header.

Use #include <iostream> instead. You may want to add  using namespace std ; after that so that you could use just cout instead of std::cout.

See for a list of standard C++ headers.

Also See:


---------- FOLLOW-UP ----------

QUESTION: after replacing "#include<iostream.h>" by "#include<iostream> using namespace std;" it is showing error "unable to open include file IOSTREAM"

ANSWER: It appears that you are either using an obsolete, non-standard, C++ compiler or there is a problem with the installation.

Could you tell me the name and the version of the compiler you are trying to use? Also the platform (Windows XP/Linux/BSD etc.).

---------- FOLLOW-UP ----------

QUESTION: version:Turbo C++ 4.5

Well, Turbo C++ is obsolete - it predates the C++ standard.

Three good options for programming in C++ on Windows XP are

a. Code::Blocks IDE along with the MinGW build of the GNU C++ compiler.
  This can be downloaded from:

b. CodeLite IDE also with the MinGW build of the GNU C++ compiler.
  This can be downloaded from:

c. The Microsoft C++ compiler and IDE.
  This can be downloaded from:

I would very strongly recommend switching to a current, standard-conforming C++ compiler.  


All Answers

Answers by Expert:

Ask Experts




my primary areas of interest are generic and template metaprogramming, STL, algorithms, design patterns and c++11. i would not answer questions about gui and web programming.


about 15 years or so

post graduate engineer

©2016 All rights reserved.