iostream.h: No such file or directory compiling cpp source

Asked by StephenB

When using c++ in terminal I get this message: g++ hello.cpp hello.cpp:1: fatal error: iostream.h: No such file or directory compilation terminated. However using g++ or gcc on c files the command works

Binary package hint: gnome-terminal

The terminal remains open but the code is not compiled and therefore I cannot use ./a.out. I have updated all files and uploaded.

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: gnome-terminal 2.32.0-0ubuntu1.1
ProcVersionSignature: Ubuntu 2.6.35-28.50-generic 2.6.35.11
Uname: Linux 2.6.35-28-generic i686
Architecture: i386
Date: Sat Apr 16 10:56:57 2011
ExecutablePath: /usr/bin/gnome-terminal
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release i386 (20101007)
ProcEnviron:
 LANG=en_US.utf8
 SHELL=/bin/bash
SourcePackage: gnome-terminal

Revision history for this message
StephenB (stephen1) said :
#1
Revision history for this message
Jeremy Bícha (jbicha) said :
#2

Have you installed build-essential?

Revision history for this message
Ubfan (ubfan1) said :
#3

Leave out the .h
#include <iostream>

Revision history for this message
StephenB (stephen1) said :
#4

Jeremy I installed build-essential double checked it is installed and updated to the latest version.

Ubfan I removed the .h just as you suggested and typed #include<iostream> but now I am getting: hello.cpp: In function ‘int main()’:
hello.cpp:6: error: ‘cout’ was not declared in this scope

Thanks for the swift reply.

Can anyone suggest another remedy.

Revision history for this message
Jeremy Bícha (jbicha) said :
#5

Try adding

using namespace std;

just below the include lines.

Revision history for this message
StephenB (stephen1) said :
#6

Yes as follows: getting: hello.cpp: In function ‘int main()’:
hello.cpp:6: error: ‘cout’ was not declared in this scope

On Sat, Apr 16, 2011 at 6:01 PM, Stephen Baptiste <
<email address hidden>> wrote:

> Your question #153064 on gcc-defaults in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/153064
>
> Status: Answered => Open
>
> You are still having a problem:
> Jeremy I installed build-essential double checked it is installed and
> updated to the latest version.
>
> Ubfan I removed the .h just as you suggested and typed #include<iostream>
> but now I am getting: hello.cpp: In function ‘int main()’:
> hello.cpp:6: error: ‘cout’ was not declared in this scope
>
> Thanks for the swift reply.
>
> Can anyone suggest another remedy.
>
> --
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
StephenB (stephen1) said :
#7

Worked perfectly.

Many thanks

On Sat, Apr 16, 2011 at 6:11 PM, Jeremy Bicha <
<email address hidden>> wrote:

> Your question #153064 on gcc-defaults in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/153064
>
> Status: Open => Answered
>
> Jeremy Bicha proposed the following answer:
> Try adding
>
> using namespace std;
>
> just below the include lines.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
>
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/153064/+confirm?answer_id=4
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/ubuntu/+source/gcc-defaults/+question/153064
>
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#8

Please mark as solved

Can you help with this problem?

Provide an answer of your own, or ask StephenB for more information if necessary.

To post a message you must log in.