Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 ユーザーズマニュアル

製品コード
SW006021-1
ページ / 518
How To’s
 2012 Microchip Technology Inc.
DS52053B-page 43
3.3
INVOKING THE COMPILER
This section discusses how the compiler is run, both on the command-line and from the 
MPLAB IDE. It includes information about how to get the compiler to do what you want 
in terms of options and the build process itself.
3.3.1
How Do I Compile from Within MPLAB X IDE?
See the documentation that comes with MPLAB X IDE for information on how to set up 
a project.
If you have one or more XC8 compilers installed, you select the compiler you wish to 
use in the Configuration category in the Project Properties dialog. The options for that 
compiler are then shown in the XC8 Compiler and XC8 Linker categories. Note that 
each of these compiler categories have several Option categories.
3.3.2
How Do I Compile on the Command-line?
The compiler driver is called xc8 for all 8-bit PIC devices; e.g., in Windows, it is named 
xc8.exe
. This application should be invoked for all aspects of compilation. It is located 
in the bin directory of the compiler distribution. Avoid running the individual compiler 
applications (such as the assembler or linker) explicitly. You can compile and link in the 
one command, even if your project is spread among multiple source files.
The driver is introduced in Section 4.2 “Invoking the Compiler”. See 3.3.4 How Can 
I Select Which Compiler I Want to Build With?
 to ensure you are running the correct 
driver if you have more than one installed. The command-line options to the driver are 
detailed in Section 4.7 “XC8 Driver Options”. The files that can be passed to the 
driver are listed and described in Section 4.2.3 “Input File Types”.
3.3.3
How Do I Compile Using a Make Utility?
When compiling using a make utility (such as make), the compilation is usually per-
formed as a two-step process: first generating the intermediate files, then the final com-
pilation and link step to produce one binary output. This is described in Section 4.3.3 
“Multi-Step Compilation”
.
The XC8 compiler uses a unique technology called OCG which uses a different inter-
mediate file format to traditional compilers (including XC16 and XC32)The intermediate 
file format used by XC8 is a p-code file (.p1 extension), not an object file. Generating 
object files as an intermediate file for multi-step compilation will defeat many of the 
advantages of this technology.