Linux command
erlc 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Compile Erlang module
erlc [module.erl]
Compile to specific directory
erlc -o [ebin] [module.erl]
Compile with debug info
erlc +debug_info [module.erl]
Include header directory
erlc -I [include] [module.erl]
Compile multiple files
erlc [*.erl]
Show warnings as errors
erlc -Werror [module.erl]
说明
erlc is the Erlang compiler, converting Erlang source files (.erl) to BEAM bytecode (.beam). It's the standard way to compile Erlang modules. The compiler supports various options for optimization, debugging, and include paths. It's typically invoked through build tools like rebar3 but can be used directly.
参数
- -o _directory_
- Output directory for compiled files.
- -I _directory_
- Add include directory.
- -D _name=value_
- Define macro.
- -W _level_
- Warning level.
- -Werror
- Treat warnings as errors.
- +debug_info
- Include debug information.
- +native
- Native code compilation (HiPE).
- -b _type_
- Output type (beam, asm, etc.).
- -v
- Verbose output.
- -pa _path_
- Add code path.
FAQ
What is the erlc command used for?
erlc is the Erlang compiler, converting Erlang source files (.erl) to BEAM bytecode (.beam). It's the standard way to compile Erlang modules. The compiler supports various options for optimization, debugging, and include paths. It's typically invoked through build tools like rebar3 but can be used directly.
How do I run a basic erlc example?
Run `erlc [module.erl]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -o _directory_ do in erlc?
Output directory for compiled files.