iPlug2 Forum

Build fails because of IText

I’m working on compiling some of my stuff for Mac. I was able to get a project working and compiled via XCode, but I ran into an issue while compiling a project with a custom control -


Ignore the const IText* te - I just forgot to remove it.

Any ideas on how to fix this? This is really gamebreaking and I would appreciate any help. Thanks

Edit: It works on Windows, but not Mac

I would create your ITexts as members of the class. In the screenshot you have a memory leak because you’re allocating a new text object on the heap each draw call using the new keyword but you don’t delete it

1 Like

It works for me with curly brackets, like this:

e.g.

pGraphics-> AttachControl (new ICaptionControl(IRECT (50,117,150,147), kMode, IText {23.,"Roboto-Regular"}, text_bg));

If they are too complex I create an IText variable inside mLayoutFunc like this:

IText myText;
myText.mSize = 20.;
myText.mFGColor = IColor(255,0,0,50);
myText.mTextEntryBGColor = IColor(0,0,0,0);
myText.mAlign = EAlign::Center;

But then again, as Oli mentioned above, it would probably be best to create member variables.

1 Like