# Temporary Files Created by the Compiler or Linker

Temporary files created by the compiler or linker reside in the directory used by the operating system to store temporary files.

To store temporary files, the driver first checks for the TMP environment variable. If defined, the directory that TMP points to is used to store temporary files.

If the TMP environment variable is not defined, the driver then checks for the TMPDIR environment variable. If defined, the directory that TMPDIR points to is used to store temporary files.

If the TMPDIR environment variable is not defined, the driver then checks for the TEMP environment variable. If defined, the directory that TEMP points to is used to store temporary files.

For Windows*, if the TEMP environment variable is not defined, the current working directory is used to store temporary files. For Linux* and macOS, if the TEMP environment variable is not defined, the /tmp directory is used to store temporary files.

Temporary files are usually deleted. Use the [Q]save-temps compiler option to save temporary files created by the compiler in the current working directory. This option only saves intermediate files that are normally created during compilation.

For performance reasons, use a local drive (rather than a network drive) to contain temporary files.

To view the file name and directory where each temporary file is created, use the all keyword for the watch option.

To create object files in your current working directory, use the c option.

Any object files that you specify on the command line are retained.

Parent topic: Fortran Language Extensions

## See Also

save-temps, Qsave-temps compiler option
watch compiler option
c compiler option