Compiling Error LGT8F328 + BlueRobotics MS5837 library

I can't compile the library example BlueRobotics MS5837 pressure sensor code for the LGT8F328 board. Follow the error message. Shoud be some incompatiblity but I don't know where and how to fix. Help please.

Arduino: 1.8.19 (Windows 10), Placa:"LGT8F328, 64 (normal), Internal 32MHz, 1, 328P-LQFP32 (e.g. MiniEVB nano-style or WAVGAT), 57600"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\acj\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\acj\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\acj\Documents\Arduino\libraries -fqbn=lgt8fx:avr:328:arduino_isp=disable,clock_source=internal,clock_div=1,variant=modelP,upload_speed=57600 -vid-pid=0000_0000 -ide-version=10819 -build-path C:\Users\acj\AppData\Local\Temp\arduino_build_630587 -warnings=none -build-cache C:\Users\acj\AppData\Local\Temp\arduino_cache_691015 -prefs=build.warn_data_percentage=75 -verbose C:\Users\acj\Documents\Arduino\libraries\BlueRobotics_MS5837_Library\examples\MS5837_Example\MS5837_Example.ino

C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\acj\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\acj\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\acj\Documents\Arduino\libraries -fqbn=lgt8fx:avr:328:arduino_isp=disable,clock_source=internal,clock_div=1,variant=modelP,upload_speed=57600 -vid-pid=0000_0000 -ide-version=10819 -build-path C:\Users\acj\AppData\Local\Temp\arduino_build_630587 -warnings=none -build-cache C:\Users\acj\AppData\Local\Temp\arduino_cache_691015 -prefs=build.warn_data_percentage=75 -verbose C:\Users\acj\Documents\Arduino\libraries\BlueRobotics_MS5837_Library\examples\MS5837_Example\MS5837_Example.ino

Using board '328' from platform in folder: C:\Users\acj\AppData\Local\Arduino15\packages\lgt8fx\hardware\avr\2.0.7

Using core 'lgt8f' from platform in folder: C:\Users\acj\AppData\Local\Arduino15\packages\lgt8fx\hardware\avr\2.0.7

Detecting libraries used...

"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DSERIAL_RX_BUFFER_SIZE=64 -DCLOCK_SOURCE=1 -DF_CPU=(32000000L/1) -DF_OSC=32000000L -DF_DIV=1 -DARDUINO=10819 -DARDUINO_AVR_LARDU_328E -DARDUINO_ARCH_AVR "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\cores\\lgt8f" "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\variants\\lgt8fx8p" "C:\\Users\\acj\\AppData\\Local\\Temp\\arduino_build_630587\\sketch\\MS5837_Example.ino.cpp" -o nul

Alternatives for Wire.h: [Wire@1.0]

ResolveLibrary(Wire.h)

  -> candidates: [Wire@1.0]

"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DSERIAL_RX_BUFFER_SIZE=64 -DCLOCK_SOURCE=1 -DF_CPU=(32000000L/1) -DF_OSC=32000000L -DF_DIV=1 -DARDUINO=10819 -DARDUINO_AVR_LARDU_328E -DARDUINO_ARCH_AVR "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\cores\\lgt8f" "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\variants\\lgt8fx8p" "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\libraries\\Wire" "C:\\Users\\acj\\AppData\\Local\\Temp\\arduino_build_630587\\sketch\\MS5837_Example.ino.cpp" -o nul

Alternatives for MS5837.h: [BlueRobotics_MS5837_Library@1.1.0]

ResolveLibrary(MS5837.h)

  -> candidates: [BlueRobotics_MS5837_Library@1.1.0]

"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DSERIAL_RX_BUFFER_SIZE=64 -DCLOCK_SOURCE=1 -DF_CPU=(32000000L/1) -DF_OSC=32000000L -DF_DIV=1 -DARDUINO=10819 -DARDUINO_AVR_LARDU_328E -DARDUINO_ARCH_AVR "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\cores\\lgt8f" "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\variants\\lgt8fx8p" "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\libraries\\Wire" "-IC:\\Users\\acj\\Documents\\Arduino\\libraries\\BlueRobotics_MS5837_Library" "C:\\Users\\acj\\AppData\\Local\\Temp\\arduino_build_630587\\sketch\\MS5837_Example.ino.cpp" -o nul

"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DSERIAL_RX_BUFFER_SIZE=64 -DCLOCK_SOURCE=1 -DF_CPU=(32000000L/1) -DF_OSC=32000000L -DF_DIV=1 -DARDUINO=10819 -DARDUINO_AVR_LARDU_328E -DARDUINO_ARCH_AVR "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\cores\\lgt8f" "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\variants\\lgt8fx8p" "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\libraries\\Wire" "-IC:\\Users\\acj\\Documents\\Arduino\\libraries\\BlueRobotics_MS5837_Library" "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\libraries\\Wire\\utility" "C:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\libraries\\Wire\\Wire.cpp" -o nul

"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DSERIAL_RX_BUFFER_SIZE=64 -DCLOCK_SOURCE=1 -DF_CPU=(32000000L/1) -DF_OSC=32000000L -DF_DIV=1 -DARDUINO=10819 -DARDUINO_AVR_LARDU_328E -DARDUINO_ARCH_AVR "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\cores\\lgt8f" "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\variants\\lgt8fx8p" "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\libraries\\Wire" "-IC:\\Users\\acj\\Documents\\Arduino\\libraries\\BlueRobotics_MS5837_Library" "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\libraries\\Wire\\utility" "C:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\libraries\\Wire\\utility\\twi.c" -o nul

"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DSERIAL_RX_BUFFER_SIZE=64 -DCLOCK_SOURCE=1 -DF_CPU=(32000000L/1) -DF_OSC=32000000L -DF_DIV=1 -DARDUINO=10819 -DARDUINO_AVR_LARDU_328E -DARDUINO_ARCH_AVR "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\cores\\lgt8f" "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\variants\\lgt8fx8p" "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\libraries\\Wire" "-IC:\\Users\\acj\\Documents\\Arduino\\libraries\\BlueRobotics_MS5837_Library" "C:\\Users\\acj\\Documents\\Arduino\\libraries\\BlueRobotics_MS5837_Library\\MS5837.cpp" -o nul

Generating function prototypes...

"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DSERIAL_RX_BUFFER_SIZE=64 -DCLOCK_SOURCE=1 -DF_CPU=(32000000L/1) -DF_OSC=32000000L -DF_DIV=1 -DARDUINO=10819 -DARDUINO_AVR_LARDU_328E -DARDUINO_ARCH_AVR "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\cores\\lgt8f" "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\variants\\lgt8fx8p" "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\libraries\\Wire" "-IC:\\Users\\acj\\Documents\\Arduino\\libraries\\BlueRobotics_MS5837_Library" "C:\\Users\\acj\\AppData\\Local\\Temp\\arduino_build_630587\\sketch\\MS5837_Example.ino.cpp" -o "C:\\Users\\acj\\AppData\\Local\\Temp\\arduino_build_630587\\preproc\\ctags_target_for_gcc_minus_e.cpp"

"C:\\Program Files (x86)\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\acj\\AppData\\Local\\Temp\\arduino_build_630587\\preproc\\ctags_target_for_gcc_minus_e.cpp"

Compilando sketch...

"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DSERIAL_RX_BUFFER_SIZE=64 -DCLOCK_SOURCE=1 -DF_CPU=(32000000L/1) -DF_OSC=32000000L -DF_DIV=1 -DARDUINO=10819 -DARDUINO_AVR_LARDU_328E -DARDUINO_ARCH_AVR "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\cores\\lgt8f" "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\variants\\lgt8fx8p" "-IC:\\Users\\acj\\AppData\\Local\\Arduino15\\packages\\lgt8fx\\hardware\\avr\\2.0.7\\libraries\\Wire" "-IC:\\Users\\acj\\Documents\\Arduino\\libraries\\BlueRobotics_MS5837_Library" "C:\\Users\\acj\\AppData\\Local\\Temp\\arduino_build_630587\\sketch\\MS5837_Example.ino.cpp" -o "C:\\Users\\acj\\AppData\\Local\\Temp\\arduino_build_630587\\sketch\\MS5837_Example.ino.cpp.o"

In file included from C:\Users\acj\AppData\Local\Arduino15\packages\lgt8fx\hardware\avr\2.0.7\variants\lgt8fx8p/pins_arduino.h:36:0,

                 from C:\Users\acj\AppData\Local\Arduino15\packages\lgt8fx\hardware\avr\2.0.7\cores\lgt8f/Arduino.h:626,

                 from C:\Users\acj\AppData\Local\Temp\arduino_build_630587\sketch\MS5837_Example.ino.cpp:1:

c:\users\acj\appdata\local\arduino15\packages\lgt8fx\hardware\avr\2.0.7\variants\standard\pins_arduino.h:111:12: error: expected unqualified-id before numeric constant

 #define D1 1 /* PD1 */

            ^

C:\Users\acj\Documents\Arduino\libraries\BlueRobotics_MS5837_Library/MS5837.h:88:11: note: in expansion of macro 'D1'

  uint32_t D1, D2;

           ^~

Usando a biblioteca Wire na versão 1.0 na pasta: C:\Users\acj\AppData\Local\Arduino15\packages\lgt8fx\hardware\avr\2.0.7\libraries\Wire 

Usando a biblioteca BlueRobotics_MS5837_Library na versão 1.1.0 na pasta: C:\Users\acj\Documents\Arduino\libraries\BlueRobotics_MS5837_Library 

exit status 1

Erro compilando para a placa LGT8F328


So the board package defines D1.

And the library uses a D1 for a variable.

The problem is that the second D1 is replaced by the value 1. The solution is to replace all 'D1' in the library with e.g. 'D1x' so there is no longer a conflict (and hope that the new variable name 'D1x' is now unique).

Can you provide a link to the board package that you are using (the URL in the additional board URLs in file → preferences) and a link to the library? I can have a look (probably tomorrow) if it's an easy fix (from a compile perspective; there is no guarantee that it will work).

Which version of the IDE do you use?

board : (similar to Nano )
https://raw.githubusercontent.com/dbuezas/lgt8fx/master/package_lgt8fx_index.json
library :

my IDE version is 1.8.19

In the BlueRoboticsMS5837 libray .h and . cpp files
I have changed the names of all D1 and D2 variables to D1x and D2x and your solution WORKED ! Thank you very much !

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.