Есть ли способ объявить исполняемые файлы с дефисами в дюне OCaml? - PullRequest
3 голосов
/ 11 июня 2019

Я настраиваю демонстрационный проект, используя dune, и хочу назвать исполняемый файл hello-world.exe вместо hello_world. Если я пытаюсь построить проект, я получаю ошибку компилятора. Как я могу объявить исполняемый файл с дефисами в имени файла?

Я использую дюну 1.9.3 и OCaml 4.05.0.

Дюна:

(executable
 (name hello-world))

hello-world.ml

let () = print_endline "Hello, World!"

ошибка сборки

$ dune build hello-world.exe
Info: creating file dune-project with this contents:
| (lang dune 1.9)

      ocamlc .hello-world.eobjs/byte/hello-world.{cmi,cmo,cmt} (exit 2)
(cd _build/default && /usr/bin/ocamlc.opt -w @a-4-29-40-41-42-44-45-48-58-59-60-40 -strict-sequence -strict-formats -short-paths -keep-locs -g -bin-annot -I .hello-world.eobjs/byte -no-alias-deps -opaque -o .hello-world.eobjs/byte/hello-world.cmo -c -impl hello-world.ml)
File "hello-world.ml", line 1:
Warning 24: bad source file name: "Hello-world" is not a valid module name.
File "hello-world.ml", line 1:
Error: Some fatal warnings were triggered (1 occurrences)

1 Ответ

3 голосов
/ 11 июня 2019

Вам нужно отключить предупреждение 24:

(executable (name hello-world) (flags (:standard -w -24)))

или просто

(executable (name hello-world) (flags (:standard -warn-error -24)))

, если вы предпочитаете оставить предупреждение

...