C++ linking error: ... AudioFFTNotesAudio ... first defined here #1114
-
I have a C++ program with multiple .h and .cpp . In one header file I use the audio and fft classes. In the corresponding header file I include : #pragma once It compiles but at the linking stage I get an error I understand what this means but I do not see how I can resolve that even when I guess its a pretty simple mistake I make. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I did not test all the optional classes to support multiple compilation units, after all an Arduino sketch consists usually of just one single sketch file So I suggest that you clone the project and after doing and testing the corrections, submit a pull request, so that others can profit from it as well. Correcting this is easy: just change |
Beta Was this translation helpful? Give feedback.
-
That resolved the linker conflict. I'm able now to complile and link without error. Thanks for the quick and constructive reply. I did make a pull request as proposed. Hopefully correctly, I'm not experienced in GitHub. |
Beta Was this translation helpful? Give feedback.
I did not test all the optional classes to support multiple compilation units, after all an Arduino sketch consists usually of just one single sketch file
So I suggest that you clone the project and after doing and testing the corrections, submit a pull request, so that others can profit from it as well.
Correcting this is easy: just change
MusicalNotes AudioFFTNotes;
to
static MusicalNotes AudioFFTNotes;
in AudioFFT.h