Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 User Manual

Product codes
SW006021-1
Page of 518
XC8 Command-line Driver
 2012 Microchip Technology Inc.
DS52053B-page 73
4.2.2
Environment Variables
When hosted on a Windows environment, the compiler uses the registry to store infor-
mation relating to the compiler installation directory and activation details, along with 
other configuration settings. That information is required whether the compiler is run on 
the command line or from within an IDE.
Under Linux and Apple OS X environments, the registry is replaced by an XML file 
which stores the same information. 
On non-Windows hosts, the compiler searches for the XML file in the following ways:
1.
The compiler looks for the presence of an environment variable called XC_XML. 
If present, this variable should contain the full path to the XML file (including the 
file’s name). 
2.
If this variable is not defined, the compiler then searches for an environment vari-
able called HOME. This variable typically contains the path to the user’s home 
directory. The compiler looks for the XML with a name .xc.xml in the directory 
indicated by the HOME variable. 
3.
If the HOME environment variable is not defined, the compiler tries to open the file 
/etc/xc.xml
4.
If none of these methods finds the XML file, an error is generated.
When running the compiler on the command line, you may wish to set the PATH envi-
ronment variable. This allows you to run the compiler driver without specifying the full 
compiler path with the driver name. Note that the directories specified by the PATH vari-
able are only used to locate the compiler driver. Once the driver is running, it uses the 
registry or XML file, described above, to locate the internal compiler applications, such 
as the parser, assembler and linker, etc. The directories specified in the PATH variable 
do not override the information contained in the registry or XML file. The MPLAB IDE 
allows the compiler to be selected via a dialog and execution of the compiler does not 
depend on the PATH variable.
4.2.3
Input File Types
xc8
 distinguishes source files, intermediate files and library files solely by the file type, 
or extension. Recognized file types are listed in Table 4-1. Alphabetic case of the 
extension is not important from the compiler’s point of view, but most operating system 
shells are case sensitive.
This means, for example, that a C source file must have a .c extension. Assembler 
files can use either .as or .asm extensions.
TABLE 4-1:
XC8
 INPUT FILE TYPES
File Type
 Meaning
.c
C source file
.p1
p-code file
.lpp
p-code library file
.as 
or .asm
Assembler source file
.obj
Relocatable object code file
.lib
Relocatable object library file
.hex
Intel HEX file