Getting started question: Creating new C++ source files and effects

I’m trying to create my own effect but I’m having trouble building. I’m relatively new to coding so I’m not sure what’s missing. I’m on MacOS using VSCode. Here’s my situation:

  1. Set up DaisyExamples, created new folder “MXNHLT” inside, able to create new files with helper script and run basic “hello world” from here.

  2. Using DaisySP/Source/Effects/flanger for testing. Copied contents of seed/DSP/Flanger example into DaisyExamples/MXNHLT after creating new folder in this location with helper.py. Able to build/run this duplicated file from here. Renamed “Flanger2Test”.

  3. In DaisySP folder, duplicated flanger.cpp and flanger.h, renamed “flanger2”. Included flanger2.h in “daisysp.h” and changed #ifndef/#define at the top, renamed class “Flanger2”.

  4. In flanger2.cpp, update to #include flanger2.h, rename all functions to “Flanger2::” etc.

  5. Change Flanger objects in MXNHLT/Flanger2Test.cpp to Flanger2, VSCode recognizes the class.

Here is the main problem:
Before changing to Flanger2 class, build_and_program_dfu works. After changing, there are several errors in the form of:
"/MXNHLT/Flanger2Test/Flanger2Test.cpp:33: undefined reference to `daisysp::Flanger2::Process(float)’

I can get the build to work just by changing Flanger2 back to Flanger.

As far as I can tell I’ve duplicated/updated the names in all of the necessary files, VSCode doesn’t see any problems, but it still won’t build. I’d be very grateful for some guidance on how to do this properly, and if my file organization is good form, e.g. if I should be putting new source files elsewhere.

Hi mxnhlt!

I would like to double check that you followed this guide: How To Create a New Project · electro-smith/DaisyWiki Wiki · GitHub

And feel free to share the Flanger2Test.cpp code here.
Also, it may help to share a screenshot of how the files are organized (in particular, what’s in the Flanger2Test folder).

Honestly, another option could be to duplicate the original flanger code and put that somewhere else safe (or you can always reinstall it) and just edit what’s in the DaisySP folder. As long as you remember that flanger code is your version, it shouldn’t be an issue.
And if you do encounter an issue, you can always replace it with the original. :wink:

Resolved: New source files placed in DaisyExamples/DaisySP/Source/ have to be added to the DaisySP/ makefile and CMakeLists.txt so that they are included when running “task build_all” to rebuild the libraries. Probably obvious to someone more familiar with C++.

1 Like