Mail Archives: djgpp/1998/02/05/04:01:51
From: | George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: curiosity (was: What am I doing wrong)
|
Date: | 5 Feb 1998 08:20:25 GMT
|
Organization: | Oxford University, England
|
Lines: | 34
|
Message-ID: | <6bbso9$3v0$5@news.ox.ac.uk>
|
References: | <01bd3163$908c9ea0$33d870ce AT dd0064>
|
NNTP-Posting-Host: | sable.ox.ac.uk
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
On 4 Feb 1998 12:00:03 GMT in comp.os.msdos.djgpp Dan
<rimfire AT shadetree DOT com> wrote:
: ok after messing with my autoexec (still with no luck of getting djgpp to
: compile
: the simple hello world code) I noticed in the docs, that its hello world
: example was
: using a slightly different version of this code (there is more then one way
: to say hello
: world when using c/c++ I've discovered) their version used "stdio.h" while
: my version used "iostream.h" . So being curios I decided to use this
: version, and wouldn't you know it, the
: darn thing compiled without a hitch.
The most likely explanation is that you are naming your source code
`foo.c'. gcc uses the extension of an input file to decide what to do
with it. When GNU CC sees a `.c' extension, it assumes that the code
is C source code and compiles it as such. The C compiler doesn't look
in the lang/cxx directory, because that is for C++ code only -- and so
it can't find iostream.h. The solution is to use one of the C++
extensions, causing GNU CC to compile your source as C++ code. It
recognises the following extensions as C++ source: `.C', `.cc',
`.cpp', `.cxx'. Note that the first is a capital letter -- GNU CC
comes from a background of case sensitive operating systems. It's
best to avoid using .C because DOS isn't really case sensitive. I
personally prefered `.cc' when I used C++.
You should also find this information towards the end of the
`readme.1st' file.
--
george DOT foot AT merton DOT oxford DOT ac DOT uk
Remember what happened to the dinosaurs.
- Raw text -