Plugin fails to compile

I’m having a go at writing a Rack plugin. I successfully generated my .cpp template, and am now trying to compile it — however, I am getting two blocking errors:

Output from `RACK_DIR=../Rack-SDK make install`
g++  -std=c++11 -Wsuggest-override   -fPIC -I../Rack-SDK/include -I../Rack-SDK/dep/include -MMD -MP -g -O3 -march=nocona -funsafe-math-optimizations -Wall -Wextra -Wno-unused-parameter -DARCH_LIN  -c -o build/src/trigsplit.cpp.o src/trigsplit.cpp
src/trigsplit.cpp:44:27: error: expected ‘)’ before ‘*’ token
  TrigsplitWidget(Trigsplit* module) {
src/trigsplit.cpp:74:76: error: no matching function for call to ‘createModel<Trigsplit, TrigsplitWidget>(const char [10])’
 Model* modelTrigsplit = createModel<Trigsplit, TrigsplitWidget>("Trigsplit");
In file included from ../Rack-SDK/include/rack.hpp:16:0,
                 from src/plugin.hpp:2,
                 from src/trigsplit.cpp:1:
../Rack-SDK/include/helpers.hpp:20:16: note: candidate: template<class TModule, class TModuleWidget> rack::plugin::Model* rack::createModel(const string&)
 plugin::Model* createModel(const std::string& slug) {
../Rack-SDK/include/helpers.hpp:20:16: note:   template argument deduction/substitution failed:
../Rack-SDK/ recipe for target 'build/src/trigsplit.cpp.o' failed
make: *** [build/src/trigsplit.cpp.o] Error 1
My code
#include "plugin.hpp"

struct Trigsplit : Module {
	enum ParamIds {
	enum InputIds {
	enum OutputIds {
	enum LightIds {

	Trigsplit() {

	void process(const ProcessArgs& args) override {
        //nothing here yet — even with something simple here, the plugin can't compile

struct TrigsplitWidget : ModuleWidget {
	TrigsplitWidget(Trigsplit* module) {
		setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/trigsplit.svg")));

		addChild(createWidget<ScrewSilver>(Vec(RACK_GRID_WIDTH, 0)));
		//addChild(createWidget<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0)));
		addChild(createWidget<ScrewSilver>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
		//addChild(createWidget<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));

		addInput(createInputCentered<PJ301MPort>(mm2px(Vec(10.16, 20.681)), module, Trigsplit::V_OCT_INPUT));
		addInput(createInputCentered<PJ301MPort>(mm2px(Vec(10.16, 45.096)), module, Trigsplit::TRIG_INPUT));

		addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(10.16, 117.056)), module, Trigsplit::TRIG_OUTPUT));

		addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 56.621)), module, Trigsplit::NOTE_C_LIGHT));
		addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 60.636)), module, Trigsplit::NOTE_CSHARP_LIGHT));
		addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 64.652)), module, Trigsplit::NOTE_D_LIGHT));
		addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 68.668)), module, Trigsplit::NOTE_DSHARP_LIGHT));
		addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 72.683)), module, Trigsplit::NOTE_E_LIGHT));
		addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 76.699)), module, Trigsplit::NOTE_F_LIGHT));
		addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 80.714)), module, Trigsplit::NOTE_FSHARP_LIGHT));
		addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 84.73)), module, Trigsplit::NOTE_G_LIGHT));
		addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 88.745)), module, Trigsplit::NOTE_GSHARP_LIGHT));
		addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 92.761)), module, Trigsplit::NOTE_A_LIGHT));
		addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 96.777)), module, Trigsplit::NOTE_ASHARP_LIGHT));
		addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(10.16, 100.792)), module, Trigsplit::NOTE_B_LIGHT));

Model* modelTrigsplit = createModel<Trigsplit, TrigsplitWidget>("Trigsplit");
Folder structure
Code /
    / Rack-SDK
    / modulaer
        / src
            / plugin.cpp, plugin.hpp, etc.
        / res/, Makefile, etc.

I can also provide plugin.json/plugin.cpp/plugin.hpp, but I don’t think that’s where my error is coming from.

Compiles fine here but there is some code missing in your post. Please complement.

@stoermelder: Done, sorry about that.

Additional info: I’m on elementary OS (Ubuntu 18.04 LTS based), and I have managed to compile the tutorial plugin before.

Thanks, still compiles fine. I’m not sure about the RACK_DIR variable though.

I’m compiling in the ‘modulaer’ folder. The headers are one level up (hence ../) and in Rack-SDK. Surely ../RAck-SDK is correct? The only other thing I can think of is in plugin.hpp I have #include <rack.hpp>, but the Fundamental plugins seem to have #include "rack.hpp". COuld this make a difference?

I’m not sure what’s going on. I suggest you re-download and extract the latest SDK.

Re-downloading the SDK didn’t help. Thanks for your time, hopefully someone else knows what’s happening here…

My plugin source lives in Rack/plugins/MyPlugin/src/, my resources in Rack/plugins/MyPlugin/res/ RACK_DIR is set as RACK_DIR ?= ../.. in my Makefile which lives in Rack/plugins/MyPlugin/

To build I just run make install from Rack/plugins/MyPlugin, try replicating this structure and see how you get on.

No change, I’m afraid.

Let’s see if you can build other plugins ok.

cd ~/Rack/plugins

git clone

cd Fundamental

make install

Start rack, if built ok the Fundamental modules should now show at the top of the module browser.

Shouldn’t that be ~/.Rack/plugins-v1? Also, where is your Rack-SDK?

No, that’s where the plugins end up once built, make install copies them to there.

Rack-SDK is in my home folder.

The Fundamental plugins are compiling just fine. I’ll copy that folder structure, and see what happens.

Edit: no change :frowning:

1 Like

Show us your Makefile pls.

It’s the default, auto-generated one

# If RACK_DIR is not defined when calling the Makefile, default to two directories above
RACK_DIR ?= ../..

# FLAGS will be passed to both the C and C++ compiler

# Careful about linking to shared libraries, since you can't assume much about the user's environment and library search path.
# Static libraries are fine, but they should be added to this plugin's build system.

# Add .cpp files to the build
SOURCES += $(wildcard src/*.cpp)

# Add files to the ZIP package when running `make dist`
# The compiled plugin and "plugin.json" are automatically added.

# Include the Rack plugin Makefile framework
include $(RACK_DIR)/

So Fundamental builds fine (so your dev tools are setup ok), you’ve replicated the directory structure for Fundamental for your own code, and you’re running make install from Rack/plugins/yourfolder? I’m at a loss and don’t know what to suggest, it should be fine.

Is your makefile in the res folder?? This and the plugin.json need to be in the root of the directory

No, my folder structure is all correct. I can see why my hasty tree diagram is confusing though

Upload it to github so we can have a closer look?

This should do it:

Let me know if that doesn’t work, I’ve never used GitHub before