Instantiation of function 'x' required here, here but no definition is available



Why are these warnings shown by qtcreator in the editor, but it still compiles fine?
How should the code be changed so the warnings are gone?

    gui.add(nPasses.setup("nPasses",1,0,10)); // instantiation of function 'ofxSlider<int>::setup' required here, but no definition is available
    gui.add(offset.setup("offset",1.0,0,20.0));  // instantiation of function 'ofxSlider<float>::setup' required here, but no definition is available


If you use ofxFloatSlider and ofxIntSlider instead, do the warnings disappear?


That’s how they are already declared in the .h file:

    ofxPanel gui;
    ofxIntSlider nPasses;
    ofxFloatSlider offset;

Is that what you meant?


Using ofParameter<int> or ofParameter<float>, and calling par.set("my par", 1,0,10) always worked for me without any warning.


That works great.

The ofxIntSlider and ofxFloatSlider are from an (old) addon, probably outdated.
Now I know how to update the examples to use the current approach :slight_smile:


you can use both declaring directly the slider or the parameter but it’s recommended to use the parameter. another way to do it, i think the best cause it’s the least verbose and the parameter range and defaults are near the declaration, is directly in the .h as:

ofParameter<int> nPasses{ "nPasses", 1, 0, 10 };
ofParameter<float> offset{ "offset", 1.f, 0.f., 20.f };
ofParameterGroup parameters{
ofxPanel panel{parameters}


Beautiful :slight_smile:

So to put it all together:


// .h
ofxPanel gui;
ofxIntSlider intA;
ofxFloatSlider floatB;

// .cpp
gui.add(intA.setup("A", 1, 0, 10));
gui.add(floatB.setup("B", 1.0f, 0, 20.0f));


// .h
ofParameter<int> intA { "A", 1, 0, 10 };
ofParameter<float> floatB { "B", 1.0f, 0, 20.0f };
ofParameterGroup parameters { "settings", intA, floatB };
ofxPanel gui { parameters };

// .cpp


this is not 0.10 specific just something you can do since c++11 so it’s been working for a while


Ok, I changed oF0.10 to c++11 :slight_smile:

ps. there was a , and ; missing in your example so I added them to my post.