Pitch Detection: Compile Error

Hello,
I’m trying to compile a C++ patch involving the Pitch Detection. When I include the header file PitchDetector.h the compilation returns error concerning about the file BiquadFilter.h, where the code use ASSERT. I tried to look at some other patches using that header, but with no result. The only thing that did something was trying to include “message.h” but that did not resolve at all (causing multiple-definition errors).
Did I missed some step? There is some include that is missing?
I am not very expert with C++ so may be a trivial error…

This is the error without message.h:
In file included from ./LibSource/PitchDetector.h:7:0, from /tmp/owl/owl-src-OV4CGo/WhammyPatch.cpp:7: ./LibSource/BiquadFilter.h: In member function 'void FilterStage::setCoefficients(FloatArray)': ./LibSource/BiquadFilter.h:42:5: error: 'ASSERT' was not declared in this scope ASSERT(coefficients.getSize()==newCoefficients.getSize(), "wrong size"); ^~~~~~ ./LibSource/BiquadFilter.h:42:5: note: suggested alternative: '__STRT' ASSERT(coefficients.getSize()==newCoefficients.getSize(), "wrong size"); ^~~~~~ __STRT ./LibSource/BiquadFilter.h: In member function 'FilterStage BiquadFilter::getFilterStage(int)': ./LibSource/BiquadFilter.h:237:5: error: 'ASSERT' was not declared in this scope ASSERT(stage < stages, "Invalid filter stage index"); ^~~~~~ ./LibSource/BiquadFilter.h:237:5: note: suggested alternative: '__STRT' ASSERT(stage < stages, "Invalid filter stage index"); ^~~~~~ __STRT ./LibSource/BiquadFilter.h: In member function 'void BiquadFilter::process(FloatArray, FloatArray)': ./LibSource/BiquadFilter.h:279:5: error: 'ASSERT' was not declared in this scope ASSERT(out.getSize() >= in.getSize(), "output array must be at least as long as input"); ^~~~~~ ./LibSource/BiquadFilter.h:279:5: note: suggested alternative: '__STRT' ASSERT(out.getSize() >= in.getSize(), "output array must be at least as long as input"); ^~~~~~ __STRT ./LibSource/BiquadFilter.h: In member function 'void BiquadFilter::setCoefficientsPointer(FloatArray)': ./LibSource/BiquadFilter.h:322:5: error: 'ASSERT' was not declared in this scope ASSERT(BIQUAD_COEFFICIENTS_PER_STAGE*stages==newCoefficients.getSize(), "wrong size"); ^~~~~~ ./LibSource/BiquadFilter.h:322:5: note: suggested alternative: '__STRT' ASSERT(BIQUAD_COEFFICIENTS_PER_STAGE*stages==newCoefficients.getSize(), "wrong size"); ^~~~~~ __STRT ./LibSource/BiquadFilter.h: In member function 'void BiquadFilter::setCoefficients(FloatArray)': ./LibSource/BiquadFilter.h:328:5: error: 'ASSERT' was not declared in this scope ASSERT(newCoefficients.getSize()==BIQUAD_COEFFICIENTS_PER_STAGE, "wrong size"); ^~~~~~ ./LibSource/BiquadFilter.h:328:5: note: suggested alternative: '__STRT' ASSERT(newCoefficients.getSize()==BIQUAD_COEFFICIENTS_PER_STAGE, "wrong size"); ^~~~~~ __STRT In file included from /tmp/owl/owl-src-OV4CGo/WhammyPatch.cpp:7:0: ./LibSource/PitchDetector.h: In member function 'int FourierPitchDetector::process(FloatArray)': ./LibSource/PitchDetector.h:60:5: error: 'ASSERT' was not declared in this scope ASSERT(input.getSize()<=fd.getSize(), "wrong size"); ^~~~~~ ./LibSource/PitchDetector.h:60:5: note: suggested alternative: '__STRT' ASSERT(input.getSize()<=fd.getSize(), "wrong size"); ^~~~~~ __STRT In file included from /tmp/owl/owl-src-OV4CGo/WhammyPatch.cpp:7:0: ./LibSource/PitchDetector.h: In member function 'void ZeroCrossingPitchDetector::process(FloatArray)': ./LibSource/PitchDetector.h:163:5: error: 'ASSERT' was not declared in this scope ASSERT(input.getSize()<=filterOutput.getSize(), "wrong size"); ^~~~~~ ./LibSource/PitchDetector.h:163:5: note: suggested alternative: '__STRT' ASSERT(input.getSize()<=filterOutput.getSize(), "wrong size"); ^~~~~~ __STRT make[1]: *** [/tmp/owl/owl-build-HGrlmq/WhammyPatch.o] Error 1 make: *** [patch] Error 2 ERROR: Patch build failed.

and this is with message.h:

/tmp/owl/owl-build-sAQpQb/PatchProgram.o (symbol from plugin): In function FilterStage::SALLEN_KEY_Q’: (.text+0x0): multiple definition of FilterStage::BESSEL_Q' /tmp/owl/owl-build-sAQpQb/WhammyPatch.o (symbol from plugin):(.text+0x0): first defined here /tmp/owl/owl-build-sAQpQb/PatchProgram.o (symbol from plugin): In function FilterStage::SALLEN_KEY_Q’: (.text+0x0): multiple definition of FilterStage::BUTTERWORTH_Q' /tmp/owl/owl-build-sAQpQb/WhammyPatch.o (symbol from plugin):(.text+0x0): first defined here /tmp/owl/owl-build-sAQpQb/PatchProgram.o (symbol from plugin): In function FilterStage::SALLEN_KEY_Q’: (.text+0x0): multiple definition of FilterStage::SALLEN_KEY_Q' /tmp/owl/owl-build-sAQpQb/WhammyPatch.o (symbol from plugin):(.text+0x0): first defined here collect2: error: ld returned 1 exit status make[1]: *** [/tmp/owl/owl-build-sAQpQb/patch.elf] Error 1 make: *** [patch] Error 2 ERROR: Patch build failed.

Any help is really appreciated
Thank you!!

I think something is getting compiled and linked twice. What are the files in your patch?

Do you have your patch in a .cpp file? It’s fine to have several .c/.cpp files, but they will be compiled as separate objects. The patch class should always be in a header file, we use .hpp.

Ah! Now i see the problem! I have only one file, i tought to write a .cpp file instead of an header.
Thank you very much!!

1 Like