CLI Compiler - tajmone/PBasmUI GitHub Wiki
PureBASIC v5.61
Quick references to using the PureBASIC compiler for Windows via command line.
Table of Contents
C:\Program Files\PureBasic\Compilers>pbcompiler.exe
PureBasic 5.61 (Windows - x64) - (c) 2016 Fantaisie Software
A filename need to be specified.
Type 'pbcompiler /?' for quick help.
C:\Program Files\PureBasic\Compilers>pbcompiler.exe /?
PBCompiler "Filename"
Command switches:
--------
/DEBUGGER: Enable the debugger
/EXE "Filename": Create an executable to the given filename
/DLL: Create a DLL
/CONSOLE: Create a console executable
/ICON "Filename": Add an icon to the executable
/RESOURCE "Filename": Add a resource file (.rc) to the executable
/QUIET: Disable all unnecessary textoutput
/COMMENTED: Produce a commented asm output (PureBasic.asm)
/REASM: Compile the 'PureBasic.asm' file to an executable
/XP: Add the Windows XP theme support to the executable
/USER: Add the 'User' hint to the executable (Windows Vista)
/ADMINISTRATOR: Add the 'Administrator' hint to the executable (Windows Vista and above)
/IMPORT "Filename": Create a import file to the given filename
/RESIDENT "Filename": Create a resident file to the given filename
/IGNORERESIDENT "Filename": ignore the given resident
/LINENUMBERING: Enable line numbering in the final executable for OnError
/STANDBY: Wait for external commands (editor, scripts...)
/MMX, /3DNOW, /SSE or /SSE2: Create a processor specific executable
/DYNAMICCPU: Create a executable containing all processor specific routines
/THREAD: Use thread safe runtime for strings and general routines
/PURIFIER: Enable the purifier
/SUBSYSTEM "Name": Use this subsystem to replace a set of internal functions
/CONSTANT Name=Value: Declare a new constant at compile time
/LINKER "ResponsFile": Specify a commands file to be passed to the linker
/CHECK: Check the syntax only, doesn't create/launch the executable
/PREPROCESS "Filename": Creates a single file with all macros expanded and all sources files included
/LANGUAGE "Language": Uses the specified language for the compiler
/VERSION: Display the version of the compiler
Some notes on PBCompiler command line usage.
The /REASM
option will re-assemble a "PureBasic.asm
" source file into a binary executable file. If no output file is specified via "/EXE <filename>.exe
" option, it will default to "PureBasic.exe
" and also launch the executable after re-assembling it (with the /EXE
option the compiled binary is not launched).
The compiler's behavior for this option is unusual, and a few warning notes are worth mentioning:
-
Even though this option only re-aseembles a source file named "
PureBasic.asm
", a valid source file needs to be passed as parameter at compiler invocation — but this file will be ignored. If no source filename is specified at comipler invocation, or if a non-existing file is specified, pbcompiler will raise a "source file not found" error", even if the "PureBasic.asm
" file exists in the working directory. -
After having checked that a valide source file was passed, the
/REASM
option will then ignore the source file and check if the "PureBasic.asm
" source file is found in the working directory, and then either proceed to reasemble it into an executable or raise a "The file 'PureBasic.asm' isn't found or can't be opened !" error. -
This option will always produce a compiled executable; there seems to be no way to avoid this. Using the
/CHECK
option together with/REASM
will prevent the creation of the asm file too (probably the/CHECK
option has the precedence over/REASM
).
In other words, the correct/safe way to use this options is:
PBCompiler.exe PureBasic.asm /REASM
... followed by any further options you might need (but not /CHECK
).
These issues are covered in more detail in post #69809 on PureBASIC's forum.
Since PureBASIC v5.50 support for Ascii compilation has been dropped, and Unicode is the only suported format. Previous versions of PureBASIC would default to Ascii compilation, and the /UNICODE
switch had to be used to create unicode binaries (in the IDE, this option was referred to as "Unicode executable").
With PBcompilers >= 5.50, the /UNICODE
switch is simply ingored, but doesn't raise any error (most likely it was kept for backward compatibility with scripted automation or third party tools).
For more information on the end of support for Ascii compilation, see PB Forum posts #60214 and #65868.