delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/05/04:23:12

Message-ID: <393B616B.16F119E1@earthlink.net>
From: Martin Ambuhl <mambuhl AT earthlink DOT net>
Organization: Nocturnal Aviation
X-Mailer: Mozilla 4.73 [en] (Win95; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help!
References: <382628516 DOT 960191061657 DOT JavaMail DOT root AT web302-mc DOT mail DOT com>
Lines: 54
Date: Mon, 05 Jun 2000 08:13:21 GMT
NNTP-Posting-Host: 63.23.142.220
X-Complaints-To: abuse AT earthlink DOT net
X-Trace: newsread2.prod.itd.earthlink.net 960192801 63.23.142.220 (Mon, 05 Jun 2000 01:13:21 PDT)
NNTP-Posting-Date: Mon, 05 Jun 2000 01:13:21 PDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com


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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019