Erlang:“include_lib”之间有什么区别?和“包括” [英] Erlang: what is the difference between "include_lib" and "include"?

查看:473
本文介绍了Erlang:“include_lib”之间有什么区别?和“包括”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

include_lib和include有什么区别?

What is the difference between "include_lib" and "include" ?

例如

-include_lib(eunit / include / eunit.hrl)

推荐答案

该文档描述了 include和include_lib 之间的区别是:

The way the documentation describes the difference between include and include_lib is:


include_lib 类似于 include ,但不应该指出绝对文件。相反,第一个路径组件(可能在变量替换后)被假设为应用程序的名称。

include_lib is similar to include, but should not point out an absolute file. Instead, the first path component (possibly after variable substitution) is assumed to be the name of an application.

示例:

-include_lib(kernel / include / file.hrl)。

代码服务器使用代码:lib_dir(内核)找到当前(最新)版本的内核的目录,然后搜索子目录include文件file.hrl。

The code server uses code:lib_dir(kernel) to find the directory of the current (latest) version of Kernel, and then the subdirectory include is searched for the file file.hrl.

所以在你的例子中,你不需要指出你包含的eunit的版本,你包括你的库路径中存在的eunit:s的最新eunit.hrl。

So in your example, you dont need to point out the version of eunit that you include, you are including the latest eunit.hrl of the eunit:s that exists in your library path.

这篇关于Erlang:“include_lib”之间有什么区别?和“包括”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆