Mail Archives: djgpp/1996/10/25/21:20:08
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 -