2018-12-30 16:43:04 -08:00
|
|
|
---
|
|
|
|
|
title: constructs / include
|
|
|
|
|
---
|
2023-11-25 09:50:24 -08:00
|
|
|
# include
|
2018-12-30 16:43:04 -08:00
|
|
|
|
docs/lpc: source-file resolution, diagnostics, full preprocessor reference
New pages: lpc/source-files (extension rules, extension-blind object
identity, registry-before-filesystem, portable-code guidance),
lpc/diagnostics (clang-style output, macro expansion notes, include
chains, fix-its, show_error_context), preprocessor/conditionals
(token-based #if with C precedence, defined()/efun_defined()) and
preprocessor/pragma (real pragma table from the driver).
Rewrote preprocessor/index (full directive table, immutable
predefines), define (function-like macros, stringize/paste, rescan,
redefinition-warning semantics) and include (search order, master
get_include_path, trailing text, macro file names); constructs/include
is now a summary pointing at the reference, and constructs/inherit
documents pathname resolution. Dropped the vestigial
preprocessor/README; sidebar gains the new pages plus the previously
unlisted text_blocks.
AGENTS.md now points agents at docs/lpc/ as the authoritative LPC
reference. Validated with a clean docusaurus production build.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 00:49:14 -07:00
|
|
|
```c
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include <mudlib.h>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
`#include` textually splices another file into the one being compiled:
|
|
|
|
|
the effect is exactly as if the contents of the header had been typed
|
|
|
|
|
at the point of the directive. Each object that includes a file gets
|
|
|
|
|
its own compiled copy of whatever the file contains — so headers are
|
|
|
|
|
for `#define`s, prototypes and shared declarations, while shared
|
|
|
|
|
*code* belongs in an [inherit](inherit)ed object.
|
|
|
|
|
|
|
|
|
|
The `"file"` form searches relative to the including file's directory
|
|
|
|
|
first and then the include path; the `<file>` form searches only the
|
|
|
|
|
include path. For the full resolution rules, macro file names,
|
|
|
|
|
trailing comments, and nesting limits, see the preprocessor reference:
|
|
|
|
|
[#include](../preprocessor/include).
|