Author Topic: error: iostream.h: No such file  (Read 11145 times)

Offline hiwords

  • Single posting newcomer
  • *
  • Posts: 2
error: iostream.h: No such file
« on: May 30, 2010, 11:54:41 pm »
Hi everybody I'm new to this forum and new to C++. I'm not a newbie to forums in general and I have done searches but can't find a solution that works. I'm using code blocks 10.05 with mingw. I'm following directions from cprogramming.com to start my learning on this programming language. The problem I'm having is i'm getting the error code:

C:\Users\Yu\Documents\C++\practice\Untitled1.c|1|error: iostream: No such file or directory|

I started a new project > chose console application > C++ > new file > empty file

main.cpp works fine with iostream but if i use the following code, it won't work.

#include <iostream>

using namespace std;

int main()
{
  cout<<"HEY, you, I'm alive! Oh, and Hello World!\n";
  cin.get();
}

I got the code from cprogramming.com tutorials. One problem I've noticed is the program saves as a .c while the main file is a .cpp. I can't seem to figure out how to save my code as a .cpp file and everytime i run it i get the same exact following error codes.

C:\Users\Yu\Documents\C++\practice\Untitled1.c|1|error: iostream: No such file or directory|
C:\Users\Yu\Documents\C++\practice\Untitled1.c|3|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'|
C:\Users\Yu\Documents\C++\practice\Untitled1.c|7|error: 'cout' undeclared (first use in this function)|
C:\Users\Yu\Documents\C++\practice\Untitled1.c|7|error: (Each undeclared identifier is reported only once|
C:\Users\Yu\Documents\C++\practice\Untitled1.c|7|error: for each function it appears in.)|
C:\Users\Yu\Documents\C++\practice\Untitled1.c|8|error: 'cin' undeclared (first use in this function)|

i think the cout and cin errors appear because of the iostream error. if i don't start a project, the code works fine. i know iostream is a header file and i have it in the program files folder. i guess my question is how do i direct that file to be used in my code?

i hope i posted in the right section, if not if an admin could please move it to the correct section. TIA

Offline hiwords

  • Single posting newcomer
  • *
  • Posts: 2
Re: error: iostream.h: No such file
« Reply #1 on: May 31, 2010, 01:19:43 am »
ok nevermind, i feel like a total idiot. all i had to do was type in .cpp after the file name lol

Offline vet873

  • Single posting newcomer
  • *
  • Posts: 2
Re: error: iostream.h: No such file
« Reply #2 on: July 17, 2010, 11:10:41 pm »
Im having a similar problem.

i type
//My first program in c++

#include <iostream>
using namespace std;

int main ()
{
    cout << "Hello World!";
    return 0;
}

the only thing that happens when i go to build is it brings up all the errors or it simply asks me again. please help

stefanos_

  • Guest
Re: error: iostream.h: No such file
« Reply #3 on: July 18, 2010, 12:45:53 am »
This is not a forum about "how to learn a new programming language" or whatsoever.

This is irrelevant to Code::Blocks therefore one of the guys most probably will lock the topic.

For more information about C / C++, please use various search engines to find your tutorials, or borrow a book from the nearest library.