Search code examples
cygwinocamlml

cygwin does not create a.out file when I compile for ocaml


I'm currently trying to start learning ocaml with cygwin, but when I try to compile an ml file, nothing happens - no error messages and no files created.

The command I used on cygwin was,

$ ocamlc hello.ml

According to my Prof., there should be a file called, a.out created on my working folder, but there was nothing.

But when I tried with this command,

$ ocamlc -o a.out hello.ml

a.out file was created properly, and I could run the compiled program using

$ ./a.out

as pointed out by the Prof.

For some experiment, I typed in the following,

$ ocamlc -o a hello.ml

This created a file named 'a' without any file extension.

So my question is, 1. Why doesn't it create the a.out file in the first place? - it should have been done according to the Prof. 2. What does the .out file do?


Solution

  • Any new file created when you type ocamlc hello.ml? Maybe camlprog.exe around? If it is, you are using MinGW OCaml over Cygwin. MinGW OCaml is a windows app therefore its default executable file name is not a.out, which is the default name for Unix and Cygwin.

    I never recommend ppl to learn OCaml with Windows or Cygwin. Since there are 3 flavors: Cygwin OCaml, MinGW OCaml and MSVC OCaml and they behave slightly different like this. And newcomers are never sure which flavor they are actually using.