DIRECTIVEPublished
#include
#include "<arquivo.ch>"Inserts a header file at the current point using the compiler include path.
Overview
#include is textual preprocessing. .ch files usually contain shared constants, commands, translations, and definitions. It is not equivalent to a complete modern module system: it neither loads code dynamically nor isolates names.
Syntax
#include "<arquivo.ch>"A basic include when required
#include "TOTVS.ch"
User Function ExInclude()
MsgInfo("Source compiled with the required definitions")
ReturnExpected result
The preprocessor incorporates header definitions before compilation.
Framework-specific include
#include "TOTVS.ch"
#include "FWMVCDef.ch"
User Function ExMVCInclude()
// O segundo cabeçalho fornece símbolos próprios do Framework MVC.
ReturnExpected result
Add a specific header only when its symbols are used.
- Include only headers required by the source and framework.
- Use the include package matching the release and LIB.
- TOTVS.ch, Protheus.ch, and other headers vary by version; not every source needs both.
- Missing, duplicated, or incompatible headers can produce unknown symbols or redefinitions.
- Do not copy random .ch files to solve compilation errors.
- This is not runtime loading.
