The SilverC Environment
A number of options are recognized in the SILVERC environment variable, if it exists. Note that each is introduced with a slash ('/'); using a minus sign ('-') is equivalent. The next character indicates which option is to be set (case not important). If the option character is not recognized, then any character up to the next slash will be ignored.
The flag settings (/w , /g , /e) may be followed by a plus sign ('+'), minus sign ('-'), a number, or nothing: a minus sign or the number 0 disables the flag; otherwise the flag is enabled.
/w treat warnings as errors (i.e. fail the compilation)
/g include symbol table information in the executable
/e retain error file
set SILVERC=/w+ /g /e-
would set warnings and symbol table generation on and disable error file retention.
To set the maximum number of errors allowed before compilation halts, use the /m setting:
where <number> is a number greater than 0. For example:
would set the maximum number of errors to be 1, causing the compiler to halt on the first error encountered.
To define a macro to the preprocessor, use the /d option. Only parameterless macros may be defined. Remember that no whitespace is allowed in the macro definition (it is allowed after the '/d' , though):
/d <macro definition>
where <macro definition> is one of:
The macro definition <token sequence> should not contain spaces. Any such macro definition is handled as if the following was seen (the first two cases have empty token sequences):
#define <identifier> <token sequence>
No error checking is done on the token sequence. For example:
set SILVERC=/dDEBUG /dRELEASE= /DVERSION=452
would behave as if the following #define directives were present in the source:
#define VERSION 801
To cause the compiler to automatically include a header file before compilation, use the /h option:
/h <header file name>
where <header file name> is the name of the header file you wish to include. Any header files so specified are loaded before normal compilation of the source file begins. The file name is taken as is, and should not include quotation marks, greater-than or less-than characters (as in a C #include directive). No further error checking is performed.
would behave as if the following #include directive was present in the source:
To specify an include path for the compiler, use the /i option:
/i <include path>
where <include path> is a file path. Any include paths so specified are searched before the normal locations (execution path, and the silver path), in order of their appearance. The include path is taken as is, with the exception that the appropriate path separator ('\' , under DOS) is appended to it, if it is not already there. No further error checking is performed.
This environment setting causes SilverC to search in the d:\headers directory for header files, before looking in the normal places.
Compile Options Command
You may also want to set compile options by using the COMPILE OPTIONS script command. This can be useful if you are using a script file to 'make' your project, since the compiler options are specified and retained in the script file. The syntax is as follows:
COMPILE OPTIONS <compile options>
where <compiler options> is any of the following:
INCLUDE <include path>
DEFINE <macro definition>
HEADER <header file name>
COMPILE OPTIONS WARNINGS ERROR_FILE DEFINE BILL INCLUDE c:\silver\include