简体   繁体   中英

Erlang: Cannot include header

I start like this:

[root@Oracle-linux-60 rabbitmq_server-3.5.6]# erl -pa ebin
Erlang/OTP 18 [erts-7.1] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V7.1  (abort with ^G)
1> -include("include/amqp_client.hrl").
** exception error: undefined shell command include/1

Why it doesn't recognize include ?

Erlang modules are really forms, but these directives are not 'Erlang' and can't be compiled, therefore this does not work.

If you want to import records you can do it with rr("include/amqp_client.hrl").

You can only enter expressions in the Erlang shell, and -include is not an expression. Similarly you can't define named functions, declare modules, etc. See eg http://ulf.wiger.net/weblog/2007/11/20/extending-the-erlang-shell-part-1/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM