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. Bug Reports
  3. 1.4 Error compiling with PinChangeInt.h library file

1.4 Error compiling with PinChangeInt.h library file

Scheduled Pinned Locked Moved Bug Reports
8 Posts 4 Posters 5.6k Views 1 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.
  • Paul AugustoP Offline
    Paul AugustoP Offline
    Paul Augusto
    wrote on last edited by
    #1

    I ran into a problem with the way the MySensors library folder is laid out. I am trying to modify a sensor sketch to use the PinChangeInt library located in the MySensors\utility folder. I am working on using it in the SceneController example posted in this forum topic http://forum.mysensors.org/topic/256/scenecontroller/9, but seeing it with any sketch. When I include the PinChangeInt library into the sketch using:
    include "utility/PinChangeInt.h"
    I get a bunch of compiler errors showing there are multiple definitions and saying they are already being defined in MyGateway.cpp. But I am not including that in the sketch. The only other includes are:

    include <MySensor.h>
    include <SPI.h>

    I can get it to compile without errors if I move MyGateway.cpp & MyGateway.h out of the MySensors library folder.

    Is the Arduino IDE trying to include everything that is in the MySensors library folder when it compiles? I also tried it on CodeBender and the same thing happens.

    I've got another question about how the MySensor.sleep function works but I'll save that for a separate forum thread.

    1 Reply Last reply
    0
    • hekH Offline
      hekH Offline
      hek
      Admin
      wrote on last edited by hek
      #2

      Don't think you can use the libraries included in MySensors utility (due to the f**d up build system of the Arduino "IDE").

      Include it separately among your libraries. You'll find it here.
      https://code.google.com/p/arduino-pinchangeint/downloads/list

      Paul AugustoP 1 Reply Last reply
      0
      • hekH hek

        Don't think you can use the libraries included in MySensors utility (due to the f**d up build system of the Arduino "IDE").

        Include it separately among your libraries. You'll find it here.
        https://code.google.com/p/arduino-pinchangeint/downloads/list

        Paul AugustoP Offline
        Paul AugustoP Offline
        Paul Augusto
        wrote on last edited by
        #3

        @hek
        Nope, just downloaded and installed PinChangeInt in the libraries separately and tried both including it in quotes and <>. I misread the error message originally, it looks like the compiler is looking at MyGateway.cpp while it is compiling my sketch and reporting the PinChangeInt functions are already defined in MY sketch.

        The original way I tried to include it:

        include "utility/PinChangeInt.h"
        MySensors\MyGateway.cpp.o: In function PCintPort::enable(PCintPort::PCintPin*, void (*)(), unsigned char)': /utility/PinChangeInt.h:366: multiple definition of PCintPort::enable(PCintPort::PCintPin*, void (*)(), unsigned char)'
        Battery_Powered_SceneController_Pin_Change.cpp.o:C:\Users\Paul\Documents\Arduino\MySensors\libraries\MySensors/utility/PinChangeInt.h:366: first defined here

        Using the separately installed PinChangeInt libarary:

        include "PinChangeInt.h" in my sketch:
        MySensors\MyGateway.cpp.o: In function PCintPort::enable(PCintPort::PCintPin*, void (*)(), unsigned char)': /utility/PinChangeInt.h:366: multiple definition of PCintPort::enable(PCintPort::PCintPin*, void (*)(), unsigned char)'
        Battery_Powered_SceneController_Pin_Change.cpp.o:C:\Users\Paul\Documents\Arduino\MySensors\libraries\PinChangeInt/PinChangeInt.h:366: first defined here

        Using either include, I can get it to compile without error if I removed MyGateway.cpp from the MySensors library folder.

        BTW, how do you wrap code fragments to display properly in the forums?

        1 Reply Last reply
        0
        • hekH Offline
          hekH Offline
          hek
          Admin
          wrote on last edited by
          #4

          I can only answer your second question.

          Get a code section by entering 4 spaces or a tab character first of each line in the code section.

          You can also surround section by 3 backquote characters ```

          1 Reply Last reply
          0
          • Paul AugustoP Offline
            Paul AugustoP Offline
            Paul Augusto
            wrote on last edited by
            #5

            I tried everything I could think of, including switching from version 1.0.5 of the Arduino IDE to version 1.5.7. Still get the same results, a conflict between my sketch trying to define the PinChangeInt functions and them already being defined in MyGateway.cpp. So I turned on verbose logging in the compiler and see it is hitting every .cpp file in the MySensors library folder. So I decided to try something else, compiling one of the example sketches. Well, it looks like the compiler is including at least something from MyGateway.cpp in every sketch. Here is what I found:

            Compiled example sketch BatteryPoweredSensor -

            With MySensors library folder as distributed:
            Sketch uses 17,732 bytes (57%) of program storage space. Maximum is 30,720 bytes.
            Global variables use 476 bytes (23%) of dynamic memory, leaving 1,572 bytes for local variables. Maximum is 2,048 bytes.

            Removing MyGateway.cpp from the MySensors library folder:
            Sketch uses 17,146 bytes (55%) of program storage space. Maximum is 30,720 bytes.
            Global variables use 443 bytes (21%) of dynamic memory, leaving 1,605 bytes for local variables. Maximum is 2,048 bytes.

            Compiled example sketch BinarySwitchSensor -

            With MySensors library folder as distributed:
            Sketch uses 14,766 bytes (48%) of program storage space. Maximum is 30,720 bytes.
            Global variables use 436 bytes (21%) of dynamic memory, leaving 1,612 bytes for local variables. Maximum is 2,048 bytes.

            Removing MyGateway.cpp from the library folder:
            Sketch uses 14,190 bytes (46%) of program storage space. Maximum is 30,720 bytes.
            Global variables use 403 bytes (19%) of dynamic memory, leaving 1,645 bytes for local variables. Maximum is 2,048 bytes.

            So, the compiled sketch is using 586 bytes more storage and 33 bytes more dynamic memory when MyGateway.cpp is present in
            the MySensors library folder. Both sketches seem to run fine compiled without MyGateway.cpp.

            MyMQTT.cpp is a gateway for a different controller, right? That one has no effect on the size of the compile sketch whether it is present in the folder or not. So there is something strange about the way MyGateway.cpp is constructed, it puts something in the compiled sketch that doesn't seem to be needed but doesn't generate any compile errors if it not present.

            I see there is an update to 1.4 that has been released. I have not tried that yet. What is the recommended method for installing the update? Just download the full zip and overwrite all the files?

            1 Reply Last reply
            0
            • hekH Offline
              hekH Offline
              hek
              Admin
              wrote on last edited by
              #6

              Ok, will have to look at this later tonight. The Arduino IDE builder is not the best on the planet (understatement).

              1 Reply Last reply
              0
              • C Offline
                C Offline
                clgary
                wrote on last edited by
                #7

                Im running into the same issue with the 1.6.1 IDE. Is there a workaround besides removing the MyGateway.cpp?

                raditvR 1 Reply Last reply
                1
                • C clgary

                  Im running into the same issue with the 1.6.1 IDE. Is there a workaround besides removing the MyGateway.cpp?

                  raditvR Offline
                  raditvR Offline
                  raditv
                  wrote on last edited by
                  #8

                  @clgary solution from @hek, try development branch :p

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


                  13

                  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