zrna-research / akso

Embedded Modular Audio DSP Platform with Visual Patcher

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linking issue with .cpp file used by multiple object-instances in a patch

ivogrig opened this issue · comments

objects.zip

  1. Extract the zip-file to "akso-community" or similar and "Reload Objects" to make them discoverable
  2. Create a blank patch
  3. Insert an "riserquencer" object
  4. Run the patch by clicking on the "Live" button
  5. Observe the Akso patcher log, there should be no errors and an "INIT RISERQUENCER CLASS" printout.
  6. Now add another "riserquencer" object
  7. Run the patch again by clicking on the "Live" button
  8. Observe the patcher log and see many "error: redefinition of 'ivogrigull::Multitrack::Multitrack()" printouts

I added both, the .h and .cpp files to the include section of the object. One header file includes the other.
Any help is appreciated, maybe I did something wrong.

Edit:

I found that I can make it work by simple adding a "#pragma once" at the top of each .cpp file.
I guess that fixes it for me but is it a good solution or is there a better, canonical best practice?

Should I close this?