Mono Compiler is not working

2019-09-06 17:40发布

问题:

I just downloaded mono compiler from its official website. I Opened cmd and went to mono director as told in mono document review (where it says how to start a program).

c->program files (X86)\Mono\bin

I have created a file and using notepad++ editor wrote a simple hello world program then saved it as

Hello.cs 

Now when i try to execute it using

mcs Hello.cs

it give error saying

mcs is not recognized as internal or external command

what should i do to execute my file?

回答1:

Read more about how to set PATH under Windows and understand more the role of the PATH environment variable (see also here).

You might need to type the entire path of your mcs batch command. So if you installed Mono in C:program files\Mono\bin you might need to type

 "C:\program files\Mono\bin\mcs" hello.cs

(To be honest, it is program files with a space that need to be escaped, so I found this)

Alternatively, use a few cd, pwd, dir commands to navigate in your file tree on the command line (or start your initial terminal by clicking appropriately somewhere). When you are in Mono then type

 bin\mcs hello.cs

of course the hello.cs should be at the appropriate place (or you type the entire path for it, e.g. bin\mcs c:\some\path\to\hello.cs)

The funny thing is that I never used Windows, and I have to remember how I used MSDOS in the 1980s. I'm using Unix since 1984 and Linux since 1993.

Your question is completely unrelated to Mono, and is just a basic misunderstanding of how Windows (or MSDOS) command line works. PATH is also, and originally, used on Unix (see some of exec POSIX functions), who steeled it from Multics.



标签: mono