Giter Site home page Giter Site logo

compile error about bridge HOT 1 OPEN

arduino-libraries avatar arduino-libraries commented on September 6, 2024 1
compile error

from bridge.

Comments (1)

dmnc-net avatar dmnc-net commented on September 6, 2024

Hi, I can't believe that this issue is still unresolved. TL;DR: scroll down for the solution.
I've got some points, let me summarize the issue here.

This piece of code can't be compiled in 1.8.3:

#include <Bridge.h>
#include <ModbusMaster.h>
void setup() {}
void loop() {}

because it produces error:
...libraries/Bridge/src/Bridge.cpp:121:33: error: '_crc_ccitt_update' was not declared in this scope

For some reason, it works if you comment out ModbusMaster.h, compile the code and then uncomment the ModbusMaster.h and recompile again. But this is not a clear solution, because a lot of code depends on modbus library (you have to comment out whole project then). Let's go for a real solution:

Bridge.cpp:105 is checking ARDUINO_ARCH_AVR:

#if defined(ARDUINO_ARCH_AVR)
#include <util/crc16.h> // AVR use an optimized implementation of CRC
#else
uint16_t _crc_ccitt_update(uint16_t crc, uint8_t data) // Generic implementation for non-AVR architectures
{
  ...
#endif

With locate and grep I've checked which util/crc16.h contains _crc_ccitt_update() and this function is not found in .../Arduino/libraries/ModbusMaster/src/util/crc16.h. This file just adds crc16_update() in case if _UTIL_CRC16_H_ is not defined but it is not regular crc16.h replacement but somehow prefered during the compilation. Probably @4-20ma should consider this as an issue.

Solution: (hotfix) rename util/crc16.h to something like crc16_.h and modify also ModbusMaster.h:58

from bridge.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.