www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/25/21:20:08

From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: gcc and capital letters
Date: 25 Oct 1996 22:13:34 GMT
Organization: Oxford University, England
Lines: 32
Message-ID: <54re2e$7qv@news.ox.ac.uk>
References: <54r7ed$4u2 AT news-central DOT tiac DOT net>
NNTP-Posting-Host: sable.ox.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Allen lyons (felawldl AT tiac DOT com) wrote:
: Does anyone know why this happens
: when I type this at the dos prompt?
: ----------------------------------------------------------
: C:\djgpp\output>gcc -o xani.exe XANI.CPP

: XANI.CPP: file not recognized: File format not recognized

: but then when I try this:

: C:\djgpp\output>gcc -o xani.exe xani.cpp

: It compiles correctly.  I realize that unix file names are case
: sensitive, but then when I try:

: C:\djgpp\output>gcc -o xani.exe XANI.c

: it works. Why are C extentions not case sensitive, but cpp extentions
: are? Why, when it parses the command line, does it not understand what
: a CPP file is but understands a C file? It would have to compare C to
: both c and C, or just convert the command line to upper or lower case
: and then just compare it with the same case? 

In a Unix environment, the case of the extension signifies the type of 
file. *.c are C source files; *.C are C++ source files. *.cc are also C++ 
source files, as are *.cpp. *.CC and *.CPP are undefined. The reason gcc 
relies on the extension in this way is that it can also take other file 
types, e.g. assembler, where again, the case is relevant. It is safest 
(IMO) to name your C source files *.c and your C++ source files *.cpp or 
*.cc, and stick to lower case when passing them to gcc.

George Foot

- Raw text -


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