Trouble with: "xxx" is a nonstatic data member or base...

28 Apr 2011

Hello, I've been fighting compiler issues with file AD9851.cpp recognizing DigitOut pins. I don't know what I am doing wrong. I have followed that others have done with their xx.cpp and .h files, but I cannot seem to get this one to compile.

I have 3 pins, all get the following error: "_name" is not a nonstatic member or base class of class "AD9851" (E292)

I've uploaded a simple sub-set of files. Any help is appreciated - kevin

/media/uploads/loopsva/testad9851.zip

28 Apr 2011

In your example _clk, _sdo and _len are not members of class AD9851. Add PinName _clk, _sdo, _len; to your class declaration.

28 Apr 2011

Thank You Ad, ...kevin

12 May 2013

I'm having the same issue with DigitalOut... "DigitalOut" is not a nonstatic data member or base class of class "Tricolor"

class Tricolor
{
public:
    Tricolor(PinName r, PinName g, PinName b) : DigitalOut _Red(r), DigitalOut _Green(g), DigitalOut _Blue(b) {
        RedPwm = 0;
        GreenPwm = 0;
        BluePwm = 0;
    }

    void SetLEDColor(uint8_t r, uint8_t g, uint8_t b);
    void LEDOn(void);
    void LEDOff(void);
private:
    // Mutex
    Mutex _led();
    
    // LED Output
    DigitalOut _Red;
    DigitalOut _Green;
    DigitalOut _Blue;
    
    // LED Color
    uint8_t _RedPwm;
    uint8_t _GreenPwm;
    uint8_t _BluePwm;
};

Suggestions?

12 May 2013

Remove the DigitalOut in front of _Red and his friends, you already declared them below, so no need to redeclare them.

12 May 2013

Erik - wrote:

Remove the DigitalOut in front of _Red and his friends, you already declared them below, so no need to redeclare them.

You sir are a saint, sorry if that seemed like an obvious error. I am still getting used to C++.

12 May 2013

Np, my method of solving it was simply checking one of my own libraries where I did something similar and look at the differences with yours :P.

Using mbed I learned alot of what is possible with C++, but for many things I still need to google the exact required syntax.