Code::Blocks

User forums => General (but related to Code::Blocks) => Topic started by: James1st on December 11, 2014, 09:17:27 am

Title: SOLVED - My simple program will not run - Sample code runs okay
Post by: James1st on December 11, 2014, 09:17:27 am
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
Title: Re: My simple program will not run - Sample code runs okay
Post by: jens on December 11, 2014, 12:11:14 pm
Make sure your file has the correct ending to be recognized as c++-file (e.g. cpp).
Title: Re: My simple program will not run - Sample code runs okay
Post by: James1st on December 11, 2014, 08:49:26 pm
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!