delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/05/15:19:41

From: Damian Yerrick <MYNAMEISd_yerrick AT hotmail DOT comNO2CANNEDHAM>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: how to compile c++ program
Organization: Pin Eight Software http://pineight.8m.com/
Message-ID: <p5ro9soevt4co605qtnfc13mda3cne0j01@4ax.com>
References: <s9omfmhq98e9 AT corp DOT supernews DOT com>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 43
X-Trace: +r4CDjhdAqA03iqdDK9kk1biqvPQPRwcIlbXUMuJOAa10YwQGxkikIwj/QtwrdMvABZYet9rhOPw!9PRUDVQTULnwE6j032ESrUEuW0oHbzJXgy4McZ3mgBcLcmipDNaEP/dtVhVeQyE3ryGlDfmPSQ==
X-Complaints-To: abuse AT gte DOT net
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
NNTP-Posting-Date: Sat, 05 Feb 2000 18:37:49 GMT
Distribution: world
Date: Sat, 05 Feb 2000 18:37:49 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Sat, 5 Feb 2000 19:12:52 +0200, "mukt1000" <mukt1 AT hotmail DOT com>
wrote:

>Hi,
> I 'm a new c programmer, I use Djgpp (v2.02) and now I want to  jump c++ ,
>  I know Djgpp is already a c++ compiler,but I cant even compile a hello
>world program with it;
>
>  //  hello.cpp

GCC (the compiler in DJGPP) likes C++ files to be named *.cc not *.cpp

>    #include <iostream.h>

Nowadays, it's normally done:
#include <iostream>            // note: no .h
using namespace std;          //  namespaces are a new feature in C++

>   void main ()

The first line of main() should always be one of these two lines:
int main(void)
int main(const int argc, const char **argv)

> {
>  cout<<"helo world"; file://or printf("hello world");

The file:// problem can be fixed by leaving a space after // comments.
It's a bug in your newsreader (Outhouse Express).

> }
>
> command line: d:\djgpp\bin:\> gcc hello.cpp  produces lots of errors;
> I tried all of the possibilities but compiler doesnt compile cpp files.

Try using gxx instead of gcc to compile your C++ programs.
gxx hello.cc -o hello.exe

-- 
Damian Yerrick  http://yerricde.tripod.com/
Comment on story ideas: http://home1.gte.net/frodo/quickjot.html
AOL is sucks! Find out why: http://anti-aol.org/faqs/aas/
View full sig: http://www.rose-hulman.edu/~yerricde/sig.html

- Raw text -


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