sensorium / Mozzi

sound synthesis library for Arduino
https://sensorium.github.io/Mozzi/
GNU Lesser General Public License v2.1
1.06k stars 185 forks source link

Compilation errors when including both WaveFolder.h and ResonantFilter.h #194

Closed techno-womble closed 1 year ago

techno-womble commented 1 year ago

Hi, The following sketch produces multiple compile errors

include

include

include

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

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

The errors are repeatable on two PCs and take the following form :-

_In file included from /home/john/Arduino/libraries/Mozzi/ResonantFilter.h:16:0, from /home/john/Arduino/libraries/Mozzi/LowPassFilter.h:16, from /home/john/Desktop/LPFandWF/LPFandWF.ino:3: /home/john/Arduino/libraries/Mozzi/IntegerType.h:2:32: error: redefinition of 'struct IntegerType' template struct IntegerType {_ ^~~

_

After some playing around I eliminated the compilation errors by adding #ifndef /#define directives to the file IntegerType.h. I must admit, I'm a bit out of my depth here so I thought I'd better log it for someone else to take a look at.

Many thanks John

tomcombriat commented 1 year ago

Hi, Did not see that coming! Indeed, preproc directives to ensure this file is included only once is the correct solution. I will try to do this today but if you are faster do not hesitate to submit a PR!

Thanks for reporting this!

tomcombriat commented 1 year ago

Hi again, @techno-womble could you please give #195 a try and report back (do not have hardware available now).

Thanks!

techno-womble commented 1 year ago

Tested and works perfectly. Thanks and keep up the great work! John