Re: error gcc compiling cpp file

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

 



la, 2003-12-13 kello 07:55, Robert L Cochran kirjoitti:
> I stand corrected -- g++ seems to be needed if your C++ program requires 
>   class libraries, as this one does. g++ calls the gcc compiler with the 
> language option set to C++ and specifies linking against the C++ libraries.
> 
> This compiles with no errors or warnings on g++:
> 

Almost complete answer but one thing was left out: ncurses. To get
"getch" and abilities to move cursor around and clear the screen one
should read ncurses man page. 

In case ncurses is not yet installed it can be found from packages:
ncurses-devel-5.3-9
ncurses-5.3-9

It is possible to map almost all of the things you find from conio.h to
(n)curses equivalents or at least it was in the beginning of 90's when I
last time took a peek at conio.h.

> #include <iostream>
> 
> using namespace std;
> 
> int main()
> {
>    cout << "MI PRIMER PROGRAMA EN C++";
>    cout << "\n\nPARA SALIR OPRIMA ENTER " << endl;
>    return 0;
> }
> 
> 
> Bob
> 
> 
> Robert L Cochran wrote:
> 
> > It doesn't matter whether you use 'gcc' or 'g++'. Read the man page for 
> > gcc carefully.
> > 
> > Bob
> > 
> > 
> > fred smith wrote:
> > 
> >> On Sat, Dec 13, 2003 at 12:23:01AM -0300, Hernan Fernandez wrote:
> >>
> >>> Hi:               (sorry my english) :(
> >>
> >>
> >>
> >> Try using "g++" innstead of "gcc", because you're compiling c++, not C.
> >>
> >>
> >>> 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
> >>>
> >>> -- 
> >>> Hernan Fernandez
> >>> uk@xxxxxxxxxxx
> >>> 0-9 475 21 72
> >>> Santiago - Chile
> >>>
> >>>
> >>> -- 
> >>> fedora-list mailing list
> >>> fedora-list@xxxxxxxxxx
> >>> To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
> >>
> >>
> >>
> > 




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

  Powered by Linux