如何包含来自Erlang/OTP模块的文件

如何包含来自Erlang/OTP模块的文件,erlang,Erlang,我需要包括一些来自Erlang/OTP模块的头文件,除了使用像 -include/usr/lib64/erlang/lib/snmp-4.25/include/snmp_types.hrl.我认为您可以使用: -include_lib("snmp/include/snmp_types.hrl"). include_lib类似于include,但不应指出 绝对文件。相反,第一个路径组件可能在 变量替换假定为应用程序的名称 Example: -include_lib("kernel/includ

我需要包括一些来自Erlang/OTP模块的头文件,除了使用像

-include/usr/lib64/erlang/lib/snmp-4.25/include/snmp_types.hrl.

我认为您可以使用:

-include_lib("snmp/include/snmp_types.hrl").
include_lib类似于include,但不应指出 绝对文件。相反,第一个路径组件可能在 变量替换假定为应用程序的名称

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中搜索文件file.hrl

我认为你可以使用:

-include_lib("snmp/include/snmp_types.hrl").
include_lib类似于include,但不应指出 绝对文件。相反,第一个路径组件可能在 变量替换假定为应用程序的名称

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中搜索文件file.hrl

是的,请参考问题:

如果从系统库中包含,则应使用-include_libXXX而不是-includeXXX。

是,请参考问题:


如果从系统库中包含,您应该使用-include_libXXX而不是-includeXXX。

以下链接可以帮助您吗???根据上面接受的答案,-include应该从代码中搜索include文件:lib_dir。但是erlc报告在-includesnmp/include/snmp_types.hrl上找不到包含文件。以下链接可能会对您有所帮助吗???根据上面接受的答案,-include应该从代码中搜索include文件:lib_dir。但erlc报告在-includesnmp/include/snmp_types.hrl上找不到包含文件。可能存在的重复项