Search code examples
erlangerlang-shell

How can I compile an Erlang file with includes from the erl shell?


erlc -I <abspath-to-include-dir> <module>.erl on the command line correctly compiles <module>

But in the Erlang shell (erl), the following produces errors with "cannot find include file":

c(<module>, [{i, <abspath-to-include-dir>}]).

Why? Shouldn't the behavior of these two ways of compiling files be the same?


Solution

  • Try writing the path as a list of directories, as in {i, [".../here/", ".../there/"]}, even if it's just a single directory.