Skip to content

Conversation

chowchin
Copy link

fixing "initializer element is not constant" error

fixing "initializer element is not constant" error
Copy link

cla-bot bot commented Nov 20, 2024

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

@stephane
Copy link
Owner

stephane commented Dec 6, 2024

It seems a wrong error (const + const = const) from your compiler. How did your trigger the issue?

@mutoukenji
Copy link

I've the same error when I cross compile with arm-linux-gnueabihf-gcc-4.9.4, any solution about it?

make --no-print-directory all-recursive
Making all in src
  CC       modbus.lo
  CC       modbus-data.lo
  CC       modbus-rtu.lo
  CC       modbus-tcp.lo
  CCLD     libmodbus.la
Making all in tests
make  all-am
  CC       bandwidth-server-one.o
  CCLD     bandwidth-server-one
  CC       bandwidth-server-many-up.o
  CCLD     bandwidth-server-many-up
  CC       bandwidth-client.o
  CCLD     bandwidth-client
  CC       random-test-server.o
  CCLD     random-test-server
  CC       random-test-client.o
  CCLD     random-test-client
  CC       unit-test-server.o
In file included from unit-test-server.c:27:0:
unit-test.h:34:1: error: initializer element is not constant
 const uint16_t UT_BITS_ADDRESS_INVALID_REQUEST_LENGTH = UT_BITS_ADDRESS + 2;
 ^
make[3]: *** [Makefile:700: unit-test-server.o] Error 1
make[2]: *** [Makefile:597: all] Error 2
make[1]: *** [Makefile:505: all-recursive] Error 1
make: *** [Makefile:391: all] Error 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants