gpt4 book ai didi

Erlang: "include_lib"和 "include"有什么区别?

转载 作者:行者123 更新时间:2023-12-03 08:48:44 26 4
gpt4 key购买 nike

"include_lib"和 "include"和有什么不一样?

例如。
-include_lib("eunit/include/eunit.hrl")

最佳答案

文档描述的方式 the difference between include and include_lib是:

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.

Example:

-include_lib("kernel/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。

关于Erlang: "include_lib"和 "include"有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1847918/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com