Re: compiler problems pt2

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

 



robert watson wrote:

> 
> I would never have tried that myself, so some sort of explanation for all this stuff in the manual would be really useful to others. After all 'HelloWorld' programs are supposed to be easy!!

Nowhere in 'info gcc' or 'info g++' nor in the on-line manuals?
> BTW How do I run the code? Double clicking doesn't work. I mean it's like clicking the desktop - absolutely nothing happens.
> 

If you want to learn more about your OS and desktop utility (whatever it
may be), this isn't the best place.  Under sh family command lines, the
usually way is to type ./a.out  None of those are part of gcc.

> 
> robert@robert-laptop:~$ gcc /home/robert/Desktop/test.c # uses c++ compiler 
No, both gcc and the .c extension ask for a C compiler.
> /home/robert/Desktop/test.c:4:20: error: iostream: No such file or directory 
> /home/robert/Desktop/test.c:5:18: error: string: No such file or directory 
> /home/robert/Desktop/test.c:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘namespace’ 
> /home/robert/Desktop/test.c: In function ‘main’: 
> /home/robert/Desktop/test.c:10: error: ‘cout’ undeclared (first use in this function) 

All of those messages should be clues that you told the compiler you had a
C program, not implementing C++ headers.
It's not possible to make a combination C and C++ compiler without C and
C++ modes.  Even MSVC has a C89 mode, (default for .c source files), where
C++ name mangling is turned off, along with command line options to accept
C++ in a .C source file. C99 is a useful programming language for many
people; nearly all compilers (excepting Microsoft) support a useful part
of it.

Yahoo mail (accessed via tbird) puts you in the Spam box. Just in case you
may be interested.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux