Re: error gcc compiling cpp file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You are putting C headers in a C++ program. The include statements are wrong.

#include <iostream>

You don't have a main() routine. You must have main().

I don't know enough of the C++ library functions to know if clrscr or getch is part of them.

Bob




Hernan Fernandez wrote:
Hi:               (sorry my english) :(

i have this one.cpp file
//-------------------------
# include <iostream.h>
# include <stdio.h>
# include <conio.h>
                                                                                                                                              void main()
{
 clrscr();
 gotoxy(20,10);
 cout<<"MI PRIMER PROGRAMA EN C++";
 cout<<"\n\nPARA SALIR OPRIMA ENTER ";
 getch();
 }
//-------------------------

i try compiling it! and i get a error :(

# gcc one.cpp -o one
En el fichero incluído de /usr/include/c++/3.3.2/backward/iostream.h:31,
                 de primer.cpp:1:
/usr/include/c++/3.3.2/backward/backward_warning.h:32:2: aviso: #warning
This file includes at least one deprecated or antiquated header. Please
consider using one of the 32 headers found in section 17.4.1.2 of the
C++ standard. Examples include substituting the <X> header for the <X.h>
header for C++ includes, or <sstream> instead of the deprecated header
<strstream.h>. To disable this warning use -Wno-deprecated.
primer.cpp:3:20: conio.h: No existe el fichero o el directorio
primer.cpp:6: error: `main' must return `int'
primer.cpp: En function `int main(...)':
primer.cpp:7: error: `clrscr' undeclared (first use this function)
primer.cpp:7: error: (Each undeclared identifier is reported only once
for each
   function it appears in.)
primer.cpp:8: error: `gotoxy' undeclared (first use this function)
primer.cpp:11: error: `getch' undeclared (first use this function)

i try too with g++ and i have the same error

Help please :D


-- Bob Cochran Greenbelt, Maryland, USA http://greenbeltcomputer.biz/





[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux