Project doesn't know OnlineUnlockStatus


#1

Hi,

i simply create a new GUI application with Projucer 5.4.1 on Mac OS10.12. I want to use OnlineUnlockStatus, but the project doesn’t know OnlineUnlockStatus class. “Use of undeclared identifier…”
Why?

Thank you
Thomas Hummel

MainComponent::MainComponent()
{
StringArray ids = OnlineUnlockStatus::getLocalMachineIDs();
setSize (600, 400);
}


#2

Did you add the juce_product_unlocking module to your project?

You might also want to have a look at the other Modules that are added by default, maybe you don’t need all of them (juce_audio_*, juce_opengl, juce_video, …).


#3

Thank you! That’s working now better. I still have a question:
I have to define some methods as they are virtual, e.g.

String OnlineUnlockStatus::getProductID()
{
    String tt="";
    return tt;
};

If i place these method definitions into MainComponent.h, it still says that i want to allocate an abstract class OnlineUnlockStatus. Only if i edit directly inside juce_OnlineUnlockStatus.h, it is accepted. Why?

Thank you Thomas


#4

This sounds like a basic C++ question, rather than a problem with JUCE.

How exactly are you inheriting and overriding methods? Have you overrriden all pure virtual methods? I suspect that if you do a bit of reading about C++ you’ll figure it out.


#5

You are not supposed to edit the files in the modules section. Instead you inherit from the OnlineUnlockStatus and override the method, similar to this:

class MyOnlineUnlockStatus : public OnlineUnlockStatus
{
    String getProductID() override
    {
        return "myProductID";
    }
};

Then you create an object of MyOnlineUnlockStatus, instead of the abstract OnlineUnlockStatus class.


#6

Thank you, you are right. I have to create a subclass…now everything works.