User forums > General (but related to Code::Blocks)

SOLVED - My simple program will not run - Sample code runs okay

(1/1)

James1st:
Hello, I am just getting started. Here is my problem -

I open Code:Blocks
I write:
#include <iostream>
using namespace std;
int main ()
{
    cout << "HEY, you, I'm alive! Oh, and Hello World\n";
    cin.get ();
}
I select, "Build and Run"
I get Build message: "fatal error: iostream: no such file or directory

I clear everything out
I click on "Open"
I navigate to the sample code and select, "Hello"
The code is identical to what I typed in.
This runs with no problems.

Thank you

Jenna:
Make sure your file has the correct ending to be recognized as c++-file (e.g. cpp).

James1st:
Thank you, that solved my problem. For some reason, I thought that the extension was automatically inserted. I will have to quickly learn not to assume anything!

Navigation

[0] Message Index

Go to full version