Author Topic: SOLVED - My simple program will not run - Sample code runs okay  (Read 3117 times)

Offline James1st

  • Single posting newcomer
  • *
  • Posts: 9
SOLVED - My simple program will not run - Sample code runs okay
« 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
« Last Edit: December 11, 2014, 08:50:28 pm by James1st »

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: My simple program will not run - Sample code runs okay
« Reply #1 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).

Offline James1st

  • Single posting newcomer
  • *
  • Posts: 9
Re: My simple program will not run - Sample code runs okay
« Reply #2 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!