Closed wbwqq closed 2 years ago
Even after running dune init project hello
, when I try to run dune build hello.exe
, I get the same error message as above Error: I cannot find the root of the current workspace/project.
...etc... Here is the list of files in the directory:
_build/
hello/
dune
dune_project
hello.ml
Probably the same root cause as #80: the Dune version has changed since the last textbook release. I'm looking into it.
Thanks! In the meantime if anyone has a similar issue, I made a small bash script as a workaround:
file=$1
filename=${file%.*}
rm -rf $filename-ocaml/
mkdir $filename-ocaml
cp $file $filename-ocaml/$file
cd $filename-ocaml
ocamlc -o $filename.byte $file
cd ..
./$filename-ocaml/$filename.byte
To compile and run a file called hello.ml
for example, if the above is in a file called run
, just run with ./run hello.ml
4e36ad6 will fix this when published.
Note that there's a simpler solution than the script above: just manually create a dune-project
file. No need for the entire directory infrastructure that dune init project
creates.
dune build hello.exe
Doesn't work. This is the error message:
It seems that the manual doesn't mention the fact that a dune project needs to be initialized.