Re: error gcc compiling cpp file

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


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++:

#include <iostream>

using namespace std;

int main()
  cout << "MI PRIMER PROGRAMA EN C++";
  cout << "\n\nPARA SALIR OPRIMA ENTER " << endl;
  return 0;


Robert L Cochran wrote:

It doesn't matter whether you use 'gcc' or 'g++'. Read the man page for gcc carefully.


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()

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 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
[email protected]
0-9 475 21 72
Santiago - Chile

-- fedora-list mailing list [email protected] To unsubscribe:

-- Bob Cochran Greenbelt, Maryland, USA

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

  Powered by Linux