Compilation on g++ at the library Iostream.h

Bug #300875 reported by Jhosman Lizarazo

This bug report was converted into a question: question #52210: Compilation on g++ at the library Iostream.h.

2
Affects Status Importance Assigned to Milestone
gcc-4.2 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Hello.

I am student of University , and then use Ubuntu Intrepid now I have to compile programs in C + + do the cogigo something as simple as this example but I get error.

    #include "iostream.h" // or #include <iostream.h>

    int main (void)
    {
    cout << "Este es mi segundo programa";
    }

The mode of compilation is: g++ Geometria.cpp -o geometria

The errors:

jhosman@jhosman-laptop:~/Escritorio$ g++ Geometria.cpp -o geometria
Geometria.cpp:5:22: error: iostream.h: No existe el fichero ó directorio
Geometria.cpp: In member function ‘void triangulo::leer()’:
Geometria.cpp:17: error: ‘cout’ no se declaró en este ámbito
Geometria.cpp:18: error: ‘cin’ no se declaró en este ámbito
Geometria.cpp: In member function ‘void circulo::leer()’:
Geometria.cpp:32: error: ‘cout’ no se declaró en este ámbito
Geometria.cpp:33: error: ‘cin’ no se declaró en este ámbito
Geometria.cpp: In member function ‘void cuadrado::leer()’:
Geometria.cpp:46: error: ‘cout’ no se declaró en este ámbito
Geometria.cpp:47: error: ‘cin’ no se declaró en este ámbito
Geometria.cpp: In member function ‘void rectangulo::leer()’:
Geometria.cpp:58: error: ‘cout’ no se declaró en este ámbito
Geometria.cpp:59: error: ‘cin’ no se declaró en este ámbito
Geometria.cpp: In member function ‘void resultado::resultados(triangulo, circulo, cuadrado, rectangulo)’:
Geometria.cpp:69: error: ‘cout’ no se declaró en este ámbito
Geometria.cpp:69: error: ‘endl’ no se declaró en este ámbito

The problem is in Ubuntu Intrepid Ibex of 32 Bits, Software Installed: g++ and all libreries of iostream and build-essentials

HELP ME

Revision history for this message
Arnaudus (a-lerouzic) wrote :

Turned into a question: the code is not valid.

Changed in gcc-4.2:
status: New → Invalid
Revision history for this message
Arnaudus (a-lerouzic) wrote :

Hi,

It works perfectly with a valid c++ code:

#include <iostream>

int main (void)
{
    std::cout << "Este es mi segundo programa";
}

Revision history for this message
Jhosman Lizarazo (jhosman) wrote :

Prove this code:

#include <iostream>

int main (void)
{
    cout << "Este es mi segundo programa";
}

or

#include "iostream.h"

int main (void)
{
    cout << "Este es mi segundo programa";
}

Revision history for this message
Jhosman Lizarazo (jhosman) wrote :

This mesage aren't a Answer is it a Bug, please move. And Help

Revision history for this message
GreatBunzinni (greatbunzinni) wrote :

It is not a bug. It's a compiler error due to badly written code. You need to know that iostream is a standard header and therefore is located in the standard compiler include path and that cout is included in the std namespace.

Why not try to learn the fundamentals before claiming a compiler error is a bug?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.