zrna-research / akso

Embedded Modular Audio DSP Platform with Visual Patcher
GNU General Public License v3.0
21 stars 7 forks source link

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

Open ivogrig opened 4 years ago

ivogrig commented 4 years ago

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?

ivogrig commented 4 years ago

Should I close this?