possible to #include header files ?

HomeForumsMonoBrick EV3 Firmwarepossible to #include header files ?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4261
    Author Image
    Helmut Wunder
    Participant

    hey,
    is it possible by Mono / C# to #include header files (e.g., #include “MonoDefs.h”)?

    Having his one could pre-define in here:

    
    // filename: "MonoDefs.h"
        using System;
        using MonoBrickFirmware;
        using MonoBrickFirmware.Movement;
        using MonoBrickFirmware.Sensors;
        using MonoBrickFirmware.Display;
        using System.Threading;
        using System.Reflection;
        using System.Resources;
    
        void init() {
          Motor m01 = new Motor(MotorPort.OutA);
          Motor m02 = new Motor(MotorPort.OutB);
          Motor m03 = new Motor(MotorPort.OutC);
          Motor m04 = new Motor(MotorPort.OutD);
         
          Lcd lcd1 = new Lcd();
        }

    and in the main program by

    #include "MonoDefs.h"
    //...
    init();

    everything would have been initialized

    #4271
    Author Image
    Anders Søborg
    Keymaster

    Not to my knowledge… remember that these are namespaces not files

    Anders

    #4279
    Author Image
    Helmut Wunder
    Participant

    thank you, now I understand!

    uses
    was known to me as a PASCAL statement which includes unit files and which worked similar like
    #include
    for (e.g., header) files in plain C
    so I confused this C# command
    using
    by the aforementioned.

    the other issue now is resolved, too – it wouldn’t work because inside an init procedure the instance variables woud be just local and not global and thus useless for their intended purpose.

    But now it’s clear, thanks again! 😎

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Posted in

Make a donation