Mail Archives: djgpp/2000/06/05/04:23:12
Scott Smith wrote:
>
> Guys--
>
> I am completely stumped.. I am brand-new to c++, trying to teach myself in
> an effort to see if programming is a possible career for me. I'm sort of
> discouraged now.. I can't get past the first (and simplest) program in the
> book! Here is my code:
>
> #include <iostream.h>
>
> main()
> {
> cout << "Hello everyone...this is easy ";
> return(0);
> }
>
> Simple, right? So, I use this command to try to compile my work:
>
> gcc test.c
Fortunately, none of the rest of your post is important.
test.c is the name of a C program.
Your program is not a C program. Rename it to have a C++ extention.
You have several choices, see the info file.
gcc is the name of the C compiler.
Your program is not a C program. Compile it with a C++ compiler.
(actually gcc will do the job, but with some additional switches.)
Your implementation will have an invoking stub that properly links the C++
libraries.
An example:
g++ test.cpp
gxx test.cpp
gpp test.cpp
(On my installation these are all aliased to the same place)
You really should use at least -W -Wall as well. I use many more, but
I need to be sure to avoid conditions you may accept.
--
Martin Ambuhl mambuhl AT earthlink DOT net
What one knows is, in youth, of little moment; they know enough who
know how to learn. - Henry Adams
A thick skin is a gift from God. - Konrad Adenauer
- Raw text -