delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/07/16:04:22

From: Jason Green <news AT jgreen4 DOT fsnet DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: NEED HELP COMPILING 1ST PROGRAM!!!!!!!!!
Date: Sun, 07 May 2000 20:53:56 +0100
Organization: Customer of Planet Online
Lines: 55
Message-ID: <k6ibhscbefornan4a7i9v6so8nke2bqqoj@4ax.com>
References: <20000507144044 DOT 03969 DOT 00001713 AT ng-fg1 DOT aol DOT com>
NNTP-Posting-Host: modem-110.avallone.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: news5.svr.pol.co.uk 957729273 10590 62.136.130.238 (7 May 2000 19:54:33 GMT)
NNTP-Posting-Date: 7 May 2000 19:54:33 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Agent 1.7/32.534
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

davidtmdu AT aol DOT com (Davidtmdu) wrote:

> I bought the book SAMS teach yourself c++ in 24 hours about a year ago - but in
> my opinion might as well be 24 years. As I am still trying to compile:

Some users have reported problems with the CD that comes with that
book.  Those problems may now be fixed, but you should consider
downloading the latest version of DJGPP from http://www.delorie.com

> #include <iostream.h>
> 
> int main()
> {
>    cout << "Hello World!\n";
>    return 0;
> }
> 
> 
> What am I doing wrong?
> I run windows 95 and use DJGPP.

You need to run a dos box under Windows.  Look for the shortcut on the
start menu to MS-DOS Prompt and use that.

> I write all that stuff up there on notepad and save it as hello.cpp on c:\

Notepad is ok for emergencies but you will soon be tired of it, and it
has the problem of saving the file as hello.cpp.txt if you are not
careful.  Download RHIDE or do a web search for a programmers editor.

> I go to RUN, and type:
> gxx <c:\hello.cpp> -o <hello.exe>

Type all the commands in the DOS box:

c:
cd \
gxx -Wall hello.cpp -o hello

> I'm pretty sure it's wrong, but what do to get it compiled to obj. file?

GCC produces .o files, but the above command compiles and links in one
go so there is no intermediate object file.

> By the way, this is the error message I get :
> 
> gxx.exe: <c:\hello.cpp>: No such file or directory (ENOENT)

Check that hello.cpp does actually exist.  Use the dir command for
this because Windows Explorer can hide file extensions and does not
always show filenames with the correct case.

Hope that helps,

Jason.

- Raw text -


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