delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/29/12:33:53

Date: Wed, 29 Sep 1999 10:28:55 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Rodeo Red <rodeored AT netstep DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: hello.cpp: No such file or directory
In-Reply-To: <4444922EAD9F4DF3.F0655FD613956B47.417327D971FC01B7@lp.airnews.net>
Message-ID: <Pine.SUN.3.91.990929102836.11087M-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Tue, 28 Sep 1999, Rodeo Red wrote:

> I compiled in RHIDE and it said there were no errors, but it made a
> program called hello.o when I thought it would make hello.exe.  What
> is going on here ?

That's because you compiled instead of compile-and-link.  The former
produces an object file, the latter produces an executable program.

> C:\WINDOWS>gcc hello.cpp -o hello.exe -lm
> c:/djgpp/tmp\cccimbbe(.text+0x19):hello.cpp: undefined reference to `cout'
> c:/djgpp/tmp\cccimbbe(.text+0x1e):hello.cpp: undefined reference to `ostream::operator<<(char const *)'
> 
> C:\WINDOWS>
> What in the world does this mean ?

It means some of the library functions called by your programs wasn't
found by the linker.

> I don't see any reference to this in the faq

I think section 8.7 explains this: you need to use gxx or gpp insteadd
of gcc to link C++ programs.

> Again, the reason it says  C:\WINDOWS> is that I can't controll the
> prompt very well. If I write prompt it gives me C:\> but I wish I
> could make it go C:\myprograms\hello>

The prompt shows the current working directory.  To change to another
directory, use the CD command, like this:

	   cd c:\myprograms

If the directory C:\myprograms doesn't exist, you will need to create
it first:

	   mkdir c:\myprograms

- Raw text -


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