src/plugin.cpp:4:1: error: expected initializer before 'Plugin'
4 | Plugin* pluginInstance;
| ^~~~~~
src/plugin.cpp: In function 'void init(rack::plugin::Plugin*)':
src/plugin.cpp:12:14: error: 'modelMidiKlokR' was not declared in this scope
12 | p->addModel(modelMidiKlokR);
after helper.py createmodule … I did add to plugin.hpp
extern Model* modelMidiKlokR
and in plugin.cpp looks like
#include "plugin.hpp"
Plugin* pluginInstance;
void init(Plugin* p) {
pluginInstance = p;
// Add modules here
// p->addModel(modelMyModule);
p->addModel(modelMidiKlokR);
// Any other plugin initialization may go here.
// As an alternative, consider lazy-loading assets and lookup tables when your module is created to reduce startup times of Rack.
}
The lesson here is that C++ error reporting is not great. The compiler will report an error against the first piece of code that it doesn’t understand, but you need to be aware that the actual problem might be further up the source file, and if you’re really unlucky, in a completely different file.