Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. #error No forward link or gateway feature activated - when including MySensors

#error No forward link or gateway feature activated - when including MySensors

Scheduled Pinned Locked Moved Development
11 Posts 3 Posters 352 Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T timo4583

    Hello everyone,

    I know this topic exists more than once in this forum, but I couldnt find a solution until now. Im not a c++ expert, so the solution might be obvious.
    Im always getting the mentioned error when splitting files and including <MySensors.h>

    here is the error then compiling:

    In file included from src/Example.h:5:0,
                     from src\Example.cpp:1:
    C:\Users\timo\.platformio\lib\MySensors_ID548/MySensors.h:426:2: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
     #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
    

    And here is my simplified code... Im trying to write external files for recurring code over serveral projects.

    src/main.cpp:

    #define MY_RADIO_RF24
    
    #include <MySensors.h>
    
    #include <Example.h>
    
    void setup()
    {
    }
    
    void presentation()
    {
    }
    
    void loop()
    {
    }
    

    src/Example.h:

    #ifndef _example_
    #define _example_
    
    #include <Arduino.h>
    #include <MySensors.h>
    
    void someFunction(int test);
    
    #endif
    

    src/Example.cpp

    #include <Example.h>
    
    void someFunction(int test) {
        Serial.println(test);
    }
    

    Environment:

    • VS Code with PlatformIO
    • MySensor lib 2.3.1

    It seems that the <MySensors.h> - include in the example file has no access to my defined constants and somehow gets executed first?
    Im not able to get rid of this problem.

    It compiles successfully if I leave out the include of MySensors in the Example.h
    Any help is appreciated :-)

    mfalkviddM Offline
    mfalkviddM Offline
    mfalkvidd
    Mod
    wrote on last edited by mfalkvidd
    #2

    Welcome to the MySensors community @timo458!
    The message tries to say that you haven't selected any transport method (which is required for a MySensors node to work), nor have you configured that you want a gateway (which can be used without a transport). So if you were allowed to upload this code, MySensors would not work, which would be pretty pointless.

    The getting started guide will probably be the quickest way to get up to speed. Perhaps https://www.mysensors.org/about/overview can be useful as well.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      timo4583
      wrote on last edited by timo4583
      #3

      Yes. But the first line of my Code is selecting the nrf24 as radio. So it should work. And indeed it works if I comment out the include of my example :

      #define MY_RADIO_RF24
      
      #include <MySensors.h>
      
      // #include <Example.h>
      
      void setup() {}
      
      void loop() {}
      

      This works and compiles without error. It has to be something with the include of MySensors in the Example.h file. But I dont know why.

      edit:
      This is a corresponding github issue I found:
      https://github.com/mysensors/MySensors/issues/485 - But it has no solution :-)

      mfalkviddM 1 Reply Last reply
      0
      • T timo4583

        Yes. But the first line of my Code is selecting the nrf24 as radio. So it should work. And indeed it works if I comment out the include of my example :

        #define MY_RADIO_RF24
        
        #include <MySensors.h>
        
        // #include <Example.h>
        
        void setup() {}
        
        void loop() {}
        

        This works and compiles without error. It has to be something with the include of MySensors in the Example.h file. But I dont know why.

        edit:
        This is a corresponding github issue I found:
        https://github.com/mysensors/MySensors/issues/485 - But it has no solution :-)

        mfalkviddM Offline
        mfalkviddM Offline
        mfalkvidd
        Mod
        wrote on last edited by
        #4

        @timo4583 I see. Thanks for explaining.

        I have no experience with Platformio but the Arduino IDE has some very strange behavior when using multiple files. Could be a side-effect of that.

        1 Reply Last reply
        0
        • mfalkviddM Offline
          mfalkviddM Offline
          mfalkvidd
          Mod
          wrote on last edited by
          #5

          Maybe the trick mentioned in https://forum.mysensors.org/post/51634 can be useful

          1 Reply Last reply
          0
          • mfalkviddM Offline
            mfalkviddM Offline
            mfalkvidd
            Mod
            wrote on last edited by
            #6

            https://github.com/mysensors/MySensors/issues/1079 might be related

            1 Reply Last reply
            0
            • T Offline
              T Offline
              timo4583
              wrote on last edited by
              #7

              Thank you very much for your help. I found a solution which is a little ugly, but it works. Splitting to header(.h) and code(.cpp) files does somehow not work with MySensors, or Im not able to find the right solution.

              For now Im no creating a seperate code(.cpp) file and put evertything to the header(.h). This works:
              /src/main.cpp:

              #define MY_RADIO_RF24
              
              #include <MySensors.h>
              
              #include <Example.h>
              
              void setup() {}
              
              void presentation() {}
              
              void loop() {}
              

              src/Example.h:

              // HEADER PART
              #ifndef _example_
              #define _example_
              
              #include <Arduino.h>
              #include <MySensors.h>
              
              void someFunction(int test);
              
              // IMPLEMENTATION PART
              
              void someFunction(int test) {
                  Serial.println(test);
              }
              
              #endif
              

              This way, it will be easy to split the files again, as soon as I find out how :-)

              1 Reply Last reply
              0
              • electrikE Offline
                electrikE Offline
                electrik
                wrote on last edited by
                #8

                What happens if you first include the example and then the Mysensors library?
                I also use platformio and it works perfectly.

                T 1 Reply Last reply
                0
                • electrikE electrik

                  What happens if you first include the example and then the Mysensors library?
                  I also use platformio and it works perfectly.

                  T Offline
                  T Offline
                  timo4583
                  wrote on last edited by
                  #9

                  @electrik Okayy.. that makes me curious. Did you try the exact same files and code like in my first post and it compiles? Changing the order does not work for me.

                  1 Reply Last reply
                  0
                  • electrikE Offline
                    electrikE Offline
                    electrik
                    wrote on last edited by
                    #10

                    No I didn't try that, just out of experience.
                    But now I see you include Mysensors.h again in the example. If you want to use mysensors functions in the header file you should just include
                    #include <core/MySensorsCore.h>
                    See also https://forum.mysensors.org/topic/6646/solved-multiple-source-files-including-mysensors-h-problem/2

                    T 1 Reply Last reply
                    1
                    • electrikE electrik

                      No I didn't try that, just out of experience.
                      But now I see you include Mysensors.h again in the example. If you want to use mysensors functions in the header file you should just include
                      #include <core/MySensorsCore.h>
                      See also https://forum.mysensors.org/topic/6646/solved-multiple-source-files-including-mysensors-h-problem/2

                      T Offline
                      T Offline
                      timo4583
                      wrote on last edited by
                      #11

                      @electrik Oh yes, that did the trick. Thank you so much

                      1 Reply Last reply
                      1
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      21

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.1k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular