error gcc compiling cpp file

Robert L Cochran cochranb at speakeasy.net
Sat Dec 13 05:55:12 UTC 2003


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;
}


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 at mitierra.cl
>>> 0-9 475 21 72
>>> Santiago - Chile
>>>
>>>
>>> -- 
>>> fedora-list mailing list
>>> fedora-list at redhat.com
>>> To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
>>
>>
>>
> 

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






More information about the fedora-list mailing list