Erlang 编译器找不到包含文件 test.hrl
Erlang compiler cannot find include file test.hrl
我有一个项目假设:
项目结构为 root/p1/mod1/include/test.hrl 和 root/p2/mod2/foo.erl
我在 root/p1/mod1/include 中有一个 erlang hrl 文件,我已将它包含在 root/p2/mod2
中的 erlang 文件 (.erl) 中
当我编译文件 foo.erl 时出现以下错误:
foo.erl:16: can't find include file "test.hrl"
我尝试将它包含在 erlc 的 -I 标志中,如下所示:
user[root/p2/mod2]$ erlc foo.erl -I "/local/user/root/p1/mod1/include"
foo.erl:16: can't find include file "test.hrl"
但是好像并没有解决。
谁能帮忙解决一下?
在Erlang中,命令应该如下:
erlc flags file1.ext file2.ext...
编译一个或多个文件。这些文件必须包含扩展名,例如,Erlang 源代码为 .erl,Yecc 源代码为 .yrl。 Erlc 使用扩展来调用正确的编译器
支持以下标志:
-I 'Directory'
所以只需将 -I 移到 erl 文件之前:
erlc -I "/local/user/root/p1/mod1/include" foo.erl
我有一个项目假设:
项目结构为 root/p1/mod1/include/test.hrl 和 root/p2/mod2/foo.erl 我在 root/p1/mod1/include 中有一个 erlang hrl 文件,我已将它包含在 root/p2/mod2
中的 erlang 文件 (.erl) 中当我编译文件 foo.erl 时出现以下错误:
foo.erl:16: can't find include file "test.hrl"
我尝试将它包含在 erlc 的 -I 标志中,如下所示:
user[root/p2/mod2]$ erlc foo.erl -I "/local/user/root/p1/mod1/include"
foo.erl:16: can't find include file "test.hrl"
但是好像并没有解决。 谁能帮忙解决一下?
在Erlang中,命令应该如下:
erlc flags file1.ext file2.ext...
编译一个或多个文件。这些文件必须包含扩展名,例如,Erlang 源代码为 .erl,Yecc 源代码为 .yrl。 Erlc 使用扩展来调用正确的编译器
支持以下标志:
-I 'Directory'
所以只需将 -I 移到 erl 文件之前:
erlc -I "/local/user/root/p1/mod1/include" foo.erl