I have created a mix project and for learning purposes, am putting all my three files in the lib folder: Client1.ex, Client2.ex and MyLibrary.ex. I have identical code in Client1.ex and Client2.ex
defmodule Project.Client1
#nothing
end
IO.puts(inspect(Project.MyLibrary.myFunc()))
When I run this in emacs using alchemist-compile-this-buffer
,the above code works for Client1 but not for Client2. I get the error
elixirc /Users/../lib/Client2.ex
lib/Client2.ex:1: warning: redefining module Project.Client2
== Compilation error on file lib/Client2.ex ==
** (UndefinedFunctionError) undefined function: Project.MyLibrary.myFunc/0 (module Project.MyLibrary is not available)
Project.MyLibrary.myFunc()
lib/Client2.ex:10: (file)
(elixir) lib/kernel/parallel_compiler.ex:95: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/8
Things I have observed:
Running mix compile works for Client2
Client2.beam is not created in the lib folder like the others BUT is in the project root folder which contains the lib folder.