DxCore icon indicating copy to clipboard operation
DxCore copied to clipboard

Clash/duplication between Logic & Comparator libraries

Open grandaspanna opened this issue 2 years ago • 5 comments

Getting a compilation error if I include both the Logic and Comparator libraries.

Probably a simple fix, but I don't know how/where.

With minimalist program:

#include <Logic.h>
#include <Comparator.h>

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

If get the following errors:

Compiling sketch...
"C:\\Users\\blahblah\\AppData\\Local\\Arduino15\\packages\\DxCore\\tools\\avr-gcc\\7.3.0-atmel3.6.1-azduino4b/bin/avr-g++" -c -g -Os -Wall -std=gnu++17 -fpermissive -Wno-sized-deallocation -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mrelax -mmcu=avr128da32 -DF_CPU=24000000L -DCLOCK_SOURCE=0 -DCORE_ATTACH_ALL -DTWI_MORS_SINGLE -DMILLIS_USE_TIMERB2 -DARDUINO=10819 -DARDUINO_avrda -DARDUINO_ARCH_MEGAAVR "-DDXCORE=\"1.4.10\"" -DDXCORE_MAJOR=1UL -DDXCORE_MINOR=4UL -DDXCORE_PATCH=10UL -DDXCORE_RELEASED=1 "-IC:\\Users\\blahblah\\AppData\\Local\\Arduino15\\packages\\DxCore\\hardware\\megaavr\\1.4.10\\cores\\dxcore/api/deprecated" "-IC:\\Users\\blahblah\\AppData\\Local\\Arduino15\\packages\\DxCore\\hardware\\megaavr\\1.4.10\\cores\\dxcore" "-IC:\\Users\\blahblah\\AppData\\Local\\Arduino15\\packages\\DxCore\\hardware\\megaavr\\1.4.10\\variants\\32pin-standard" "-IC:\\Users\\blahblah\\AppData\\Local\\Arduino15\\packages\\DxCore\\hardware\\megaavr\\1.4.10\\libraries\\Logic\\src" "-IC:\\Users\\blahblah\\AppData\\Local\\Arduino15\\packages\\DxCore\\hardware\\megaavr\\1.4.10\\libraries\\Comparator\\src" "C:\\Users\\blahblah\\AppData\\Local\\Temp\\arduino_build_57917\\sketch\\CCL_comp_test.ino.cpp" -o "C:\\Users\\blahblah\\AppData\\Local\\Temp\\arduino_build_57917\\sketch\\CCL_comp_test.ino.cpp.o"
In file included from C:\Users\blahblah\Documents\Arduino\CCL_comp_test\CCL_comp_test.ino:2:0:
C:\Users\blahblah\AppData\Local\Arduino15\packages\DxCore\hardware\megaavr\1.4.10\libraries\Comparator\src/Comparator.h:63:8: error: multiple definition of 'enum out::output_t'
   enum output_t : uint8_t {
        ^~~~~~~~
In file included from C:\Users\blahblah\Documents\Arduino\CCL_comp_test\CCL_comp_test.ino:1:0:
C:\Users\blahblah\AppData\Local\Arduino15\packages\DxCore\hardware\megaavr\1.4.10\libraries\Logic\src/Logic.h:165:8: note: previous definition here
   enum output_t : uint8_t {
        ^~~~~~~~
In file included from C:\Users\blahblah\Documents\Arduino\CCL_comp_test\CCL_comp_test.ino:2:0:
C:\Users\blahblah\AppData\Local\Arduino15\packages\DxCore\hardware\megaavr\1.4.10\libraries\Comparator\src/Comparator.h:70:8: error: multiple definition of 'enum out::pinswap_t'
   enum pinswap_t : uint8_t {
        ^~~~~~~~~
In file included from C:\Users\blahblah\Documents\Arduino\CCL_comp_test\CCL_comp_test.ino:1:0:
C:\Users\blahblah\AppData\Local\Arduino15\packages\DxCore\hardware\megaavr\1.4.10\libraries\Logic\src/Logic.h:169:8: note: previous definition here
   enum pinswap_t : uint8_t {
        ^~~~~~~~~
Using library Logic at version 1.1.2 in folder: C:\Users\blahblah\AppData\Local\Arduino15\packages\DxCore\hardware\megaavr\1.4.10\libraries\Logic 
Using library Comparator at version 1.2.0 in folder: C:\Users\blahblah\AppData\Local\Arduino15\packages\DxCore\hardware\megaavr\1.4.10\libraries\Comparator 
exit status 1
Error compiling for board AVR DA-series (no bootloader).


grandaspanna avatar May 22 '22 04:05 grandaspanna

@MCUdude - what's the correct way to fix this one?

SpenceKonde avatar May 22 '22 16:05 SpenceKonde

Cannot proceed on this without help from someone more knowledgeable about C++

SpenceKonde avatar Jun 06 '22 17:06 SpenceKonde

I've come up with a fix: https://github.com/MCUdude/MegaCoreX/issues/150

MCUdude avatar Jun 12 '22 19:06 MCUdude

These changes need to be pulled in from megaTinyCore now and corresponding changes made to ZCD and Opamp.

SpenceKonde avatar Jul 23 '22 22:07 SpenceKonde

I think this is fixed but can't tell until core compiles anything successfully

SpenceKonde avatar Aug 13 '22 23:08 SpenceKonde

The fix has been ported and this core has some functionality intact.

As long as you have millis disabled at least. If you don't, everything is fucked

SpenceKonde avatar Nov 09 '22 08:11 SpenceKonde