Announcement

Collapse
No announcement yet.

OT: Anyone used the "Mono" C# compiler?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • OT: Anyone used the "Mono" C# compiler?

    Trying to get this working, and have not managed to get the hello program to work.

    I get a cannot be found error, and I suppose the source file is not located where the compiler wants it. That location is not documented in any place I have yet found.

    So far the thing is not "just working" as it is supposed to.

    Win 7, which is listed as OK.

    This actually is machining related in a rather roundabout way.
    4357 2773 5647 3671 3645 0087 1276

    CNC machines only go through the motions

    "There's no pleasing these serpents"......Lewis Carroll

  • #2
    Mono is installed in C:\Program Files (x86)\mono. Your source files should be able to be in any folder.

    Comment


    • #3
      That's what I figured.... but so far I can't seem to make it find the file when I point it at the correct place
      4357 2773 5647 3671 3645 0087 1276

      CNC machines only go through the motions

      "There's no pleasing these serpents"......Lewis Carroll

      Comment


      • #4
        I just installed mono-devel on Fedora 23 ( linux here)

        My test source code called PR_helloworld.cs :
        -----------------
        using System;

        public class HelloWorld
        {
        static public void Main ()
        {
        Console.WriteLine ("Hello Mono World");
        }
        }

        ------------------------------------------------------

        The following is my terminal , first cd to the dir containing the source code file,
        Then compile, using mcs, to make PR_helloworld.exe
        Then executing the exe, using mono, with the expected output
        --------------------------------------------------

        [[email protected] /]$ cd /home/xterm3/PR_monoC#
        [[email protected] PR_monoC#]$ mcs PR_helloworld.cs
        [[email protected] PR_monoC#]$ mono PR_helloworld.exe
        Hello Mono World
        [[email protected] PR_monoC#]$
        Last edited by wombat2go; 06-27-2017, 08:16 PM.

        Comment


        • #5
          Try this command line in the mono cmd window: C:\mono_Source>"C:\Program Files\Mono\lib\mono\4.5\mcs.exe" HelloMono.cs

          First create the c:\mono_Source folder, then the HelloMono.cs file with the HelloWorld code.

          Mono cmd window is executed from a batch file with these contents:
          @echo off
          "%~dp0\mono.exe" %MONO_OPTIONS% "%~dp0\..\lib\mono\4.5\mcs.exe" %*

          It seems like the path isn't getting set correctly when the batch file is run. It gets set to the mono bin folder where the batch file is located but not to the folder containing the real mcs.exe.

          Comment


          • #6
            I have done most of those options, without getting it to "go". But I was following the basic "getting started" info from the Mono site. Didn't do any batch files.

            I'll give it another try tomorrow.
            4357 2773 5647 3671 3645 0087 1276

            CNC machines only go through the motions

            "There's no pleasing these serpents"......Lewis Carroll

            Comment


            • #7
              The sentence order was not optimum in my last post

              Create the hello world file in any convenient folder.
              CD to that folder in the mono cmd window.
              Run the command: "C:\Program Files\Mono\lib\mono\4.5\mcs.exe" <Your Hello world.cs>


              There is no need to create a batch file. I was just showing how mono was being executed.

              Comment


              • #8
                To check environmental variables in Win,
                open a dos terminal ( in your working dir) and type
                SET

                Comment


                • #9
                  Originally posted by J Tiers View Post
                  Trying to get this working, and have not managed to get the hello program to work.

                  I get a cannot be found error, and I suppose the source file is not located where the compiler wants it. That location is not documented in any place I have yet found.

                  So far the thing is not "just working" as it is supposed to.

                  Win 7, which is listed as OK.

                  This actually is machining related in a rather roundabout way.
                  Just to make sure - you are running into issues getting your code to compile using the C# compiler that is bundled with mono? I want to be sure you know the difference between the .NET framework, the .NET runtime, and what it means to develop a .NET application on any platform versus running a .NET application on any platform.
                  Max
                  http://joyofprecision.com/

                  Comment


                  • #10
                    This might be worth reading:
                    https://www.codeproject.com/Articles...first-Mono-app

                    Extract from it that may be relevant to JT
                    "
                    Also, when using Mono on Windows it would be a good idea to add the
                    <Mono_Install_Dir>\bin\ and <Mono_Install_Dir>\lib\ directories
                    to your path (C:\Program Files\Mono-1.0.5\bin\ and C:\Program Files\Mono-1.0.5\lib\ on my system).
                    This will allow you to use the above tools directly from the command line regardless of which directory
                    you are currently working in.

                    Comment

                    Working...
                    X