fatal error: iostream: No such file or directory.

I am trying to find my first compiler to begin coding and compiling files on. I have just downloaded Code::Blocks (after searching for hours and even downloading and trying multiple different compilers (all to which have led to failures and had to be uninstalled)) and coded the following:

1
2
3
4
5
6
7
8
9
 #include <iostream>
using namespace std;

int main()
{
    cout << "Hello world!";

    return 0;
}


Using what I thought was the compiler that is stored in the Code::Blocks files, I tried executing the program with GNU GCC Compiler.

When I tried to build the program, nothing happened. When I tried running the program, an error window popped up telling me that the program hadn't been built.
Further investigation of the Build Messages lead me to an error statement suggesting the following:

"fatal error: iostream: No such file or directory."


I am trying to get this compiler to work but I don't know what to do. I've tried other compiler options but Build Messages tell me that I don't seem to have any other compilers.

Help.

NOTE: The first line of code (containing '#include <iostream>') was marked since I received the error message in the Build Messages.

ANOTHER NOTE: I don't know if I'm being as specific as I can. Is there something that I am supposed to check (like the Build Messages) that would help me give you useful information? I.E.- Is there anything you want to know specifically? I'm new and I don't know what to look for when things mess up like they did on my computer.
Hi,
You need to use g++, instead of gcc. Then it should work fine.
Thanks for the tip. Although I ended up getting Orwell Dev-C++ instead.

g++ didn't come up on the list of compilers I could use.
Make sure that the name of the file identifies it as a C++ source file.

For instance: not main.c, but main.cpp or main.cc
Topic archived. No new replies allowed.