Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: Library Conflict

  1. #1

    Library Conflict

    I tried adding the HX711 load cell library to a working existing sketch and it causes a warning. Here is the minimal code that shows the conflict. if i comment out any one, it is fine. the warning message is posted below the code. Can I just ignore this or do i need to remove the "define" in one or more location.

    #include <OneWire.h>
    #include <Encoder.h>
    #include "HX711.h"

    void setup() {

    }
    void loop() {

    }


    C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Encode r/utility/direct_pin_read.h:7:0: warning: "PIN_TO_BASEREG" redefined

    #define PIN_TO_BASEREG(pin) (portInputRegister(digitalPinToPort(pin)))

    ^

    In file included from C:\Arduino\my_programs\temp-controller-ss-lcd-one-wire-test-i2c-display_test11\temp-controller-ss-lcd-one-wire-test-i2c-display_test11.ino:2:0:

    C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\OneWir e/OneWire.h:74:0: note: this is the location of the previous definition

    #define PIN_TO_BASEREG(pin) (portOutputRegister(pin))

    ^

    In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Encode r/Encoder.h:41:0,

    from C:\Arduino\my_programs\temp-controller-ss-lcd-one-wire-test-i2c-display_test11\temp-controller-ss-lcd-one-wire-test-i2c-display_test11.ino:3:

    C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Encode r/utility/direct_pin_read.h:8:0: warning: "PIN_TO_BITMASK" redefined

    #define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))

    ^

    In file included from C:\Arduino\my_programs\temp-controller-ss-lcd-one-wire-test-i2c-display_test11\temp-controller-ss-lcd-one-wire-test-i2c-display_test11.ino:2:0:

    C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\OneWir e/OneWire.h:75:0: note: this is the location of the previous definition

    #define PIN_TO_BITMASK(pin) (1)

    ^

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    7,066
    See what changes if the "#include <OneWire.h>" is commented out? It is being included already by one of the others.

  3. #3
    if i comment out one wire, it is fine as it is if any other single include is commented out. strange because this is not a problem in the original script which has one wire and encoder. it only becomes a problem when i add HX711.h is this just an annoyance caused by redundant definitions of
    #define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin)) can i just ignore it? it is annoying that all the warnings how up in red. shouldn't red be for errors not harmless warnings.

    i wanted to start using a different IDE than the Arduino one but it looks like it will be a lot of work to get something else working with teensy. Any quick and easy to install IDE that has less bullshit than the Arduino stock IDE?

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,664
    Which library do I install for "HX711.h"?

    When I search in Arduino's library manager, there seem to be 2, by Olav Kallhovd and Scott Russell. Is it either of those?

  5. #5
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,060
    Every IDE, bullshit or not, uses the same gcc compiler, thus you’ll get the same warnings or error messages if you try to compile poorly written code.

    In your situation, I’d rather fix the HX711.h file, either by commenting out these redundant defines which is a quick workaround, or by surrounding them with #ifndef tags as a durable solution.

  6. #6
    i should have made the request for another IDE separate. it is not the warnings that are such a problem with the arduino IDE. there are many other annoyances i would like to get rid of.

  7. #7
    i am not finding the authors on either of the two libraries i have. any hints on how to identify them? i have looked at the readme files in the zips they came from and also the h and cpp code. no mention of either of these authors.

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,664
    In Arduino, click Sketch > Include Library > Manage Libraries. Then type HX711 into the "filter your search" box in the upper right corner of the "Library Manager" window.

    That is how you find the 2 libraries I was able to locate. Each has a "more info" link that opens up a web browser to the github repositories for those libraries.

    Maybe you could tell me where to download the ZIP file you have? I can't give you any hint on how to identify the library you actually have, because you've not told me anything specific about it. But you can use those links to get plenty of info about the two from the library manager. Maybe you'll be able to confirm what you have matches one of those two? Or maybe it's a 3rd, entirely different HX711 library?

    Really, I want to help you and I want to investigate what's causing this error you happen.... but if I don't even know which HX711 you have, can you see how that lack of specific information makes helping you pretty much impossible?

    Regarding the colorful language about the Arduino IDE, yes, compile errors with libraries are frustrating. But your hate for Arduino is misplaced. From even the limited info so far, this is pretty clearly a case of combining 3 different libraries, none of them actually authored by the Arduino devs. Admittedly, I am the author of 2 of those libraries (well, OneWire was originally written by others, but I've been maintaining it for years after the original authors abandoned the code, and in a pretty terribly buggy state back then). But despite my best efforts to make things work together, I can't possibly test the many libraries I maintain with every permutation of the thousands of other libraries authored by other people. The best I can do is try to make things as reasonable as possible and then respond to problems as they come up. But without even knowing which specific HX711 code you are using, I can't even do that.

  9. #9
    i removed the HX711 library and installed the one from Olav Kallhovd and changed my code to work with it. seems to be just as good for my needs as the other one so no problem there. i still get the warning about the redundant define with the new library.

    my complaint about the warnings is that it makes for a bunch of crap to sort through just to find a legitimate error. my main complaint about the arduino ide is that the error pane is not wide enough to contain the full lines of the messages and there does not seem to be any way to make word wrapping work so to find the relevant part of an error message i have to scroll through all the irrelevant crap and then scroll left and right to read the whole line. i have changed all the variables i can not find any way to make this work.

  10. #10
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    7,066
    IDE allows for 'File / Preferences / Use External Editor'. Compile and upload is initiated from IDE - but it uses code edited from disk by external editor of your choice.

    Indeed no doubt warnings are distracting - should be resolved or removed as a simple warning may indicate a fail for proper compile.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •