Error in simple 7 segment library

Hi Arduino Forums,

i'm having a slice of trouble making my library work to my fitting.

I have dusted the code over and over to see if there is something i have missed, but when i try to compare the notes from Arduino references to my code, i have a hard time understanding what the references mean. It might be all my fault but i'm stuck none the less..

here's my header code:

/*
This header is dedicated to my
7 segment counter library for Arduino Uno

ERIK KLINT, MERCANTEC SKP
*/
#ifndef skpssc_h
#define skpssc_h

const int dpA = 0; // name output pins: 0-3 + 8
const int dpB = 1;
const int dpC = 2;
const int dpD = 3;
const int pwr = 8; // Transistor base enabler pin 8

void setup() // set pins to OUTPUT
{
    pinMode(dpA, OUTPUT);
    pinMode(dpB, OUTPUT);
    pinMode(dpC, OUTPUT);
    pinMode(dpD, OUTPUT);
    pinMode(pwr, OUTPUT);
}

void loop()
{
    zero(); 
    one(); 
    two(); 
    three(); 
    four(); 
    five(); 
    six(); 
    seven(); 
    eight(); 
    nine();
}
void zero() // Show zero on 7 segment
{
    digitalWrite(pwr, HIGH);
    digitalWrite(dpA, LOW);
    digitalWrite(dpB, LOW);
    digitalWrite(dpC, LOW);
    digitalWrite(dpD, LOW);
    delay(1000);
    digitalWrite(pwr, LOW);
}
void one() // Show one on 7 segment
{
    digitalWrite(pwr, HIGH);
    digitalWrite(dpA, HIGH);
    digitalWrite(dpB, LOW);
    digitalWrite(dpC, LOW);
    digitalWrite(dpD, LOW);
    delay(1000);
    digitalWrite(pwr, LOW);
}
void two() // Show two on 7 segment
{
    digitalWrite(pwr, HIGH);
    digitalWrite(dpA, LOW);
    digitalWrite(dpB, HIGH);
    digitalWrite(dpC, LOW);
    digitalWrite(dpD, LOW);
    delay(1000);
    digitalWrite(pwr, LOW);
}
void three() // Show three on 7 segment
{
    digitalWrite(pwr, HIGH);
    digitalWrite(dpA, HIGH);
    digitalWrite(dpB, HIGH);
    digitalWrite(dpC, LOW);
    digitalWrite(dpD, LOW);
    delay(1000);
    digitalWrite(pwr, LOW);
}
void four() // Show four on 7 segment
{
    digitalWrite(pwr, HIGH);
    digitalWrite(dpA, LOW);
    digitalWrite(dpB, LOW);
    digitalWrite(dpC, HIGH);
    digitalWrite(dpD, LOW);
    delay(1000);
    digitalWrite(pwr, LOW);
}
void five() // Show five on 7 segment
{
    digitalWrite(pwr, HIGH);
    digitalWrite(dpA, HIGH);
    digitalWrite(dpB, LOW);
    digitalWrite(dpC, HIGH);
    digitalWrite(dpD, LOW);
    delay(1000);
    digitalWrite(pwr, LOW);
}
void six() // Show six on 7 segment
{
    digitalWrite(pwr, HIGH);
    digitalWrite(dpA, LOW);
    digitalWrite(dpB, HIGH);
    digitalWrite(dpC, HIGH);
    digitalWrite(dpD, LOW);
    delay(1000);
    digitalWrite(pwr, LOW);
}
void seven() // Show seven on 7 segment
{
    digitalWrite(pwr, HIGH);
    digitalWrite(dpA, HIGH);
    digitalWrite(dpB, HIGH);
    digitalWrite(dpC, HIGH);
    digitalWrite(dpD, LOW);
    delay(1000);
    digitalWrite(pwr, LOW);
}
void eight() // Show eight on 7 segment
{
    digitalWrite(pwr, HIGH);
    digitalWrite(dpA, LOW);
    digitalWrite(dpB, LOW);
    digitalWrite(dpC, LOW);
    digitalWrite(dpD, HIGH);
    delay(1000);
    digitalWrite(pwr, LOW);
}
void nine() // Show nine on 7 segment
{
    digitalWrite(pwr, HIGH);
    digitalWrite(dpA, HIGH);
    digitalWrite(dpB, LOW);
    digitalWrite(dpC, LOW);
    digitalWrite(dpD, HIGH);
    delay(1000);
    digitalWrite(pwr, LOW);
}

class skpssc
{
  public:
    skpssc(const int dpA, const int dpB, const int dpC, const int dpD, const int pwr);
    void zero();
    void one();
    void two();
    void three();
    void four();
    void five();
    void six();
    void seven();
    void eight();
    void nine();
  private:
    const int _pwr;
    const int _dpa;
    const int _dpb;
    const int _dpc;
    const int _dpd;
};
#endif

and here's my .cpp:

/* BEGIN DOC */
#include "skpssc.h"

skpssc::skpssc(const int pwr, const int dpA, const int dpB, const int dpC, const int dpD)
{
  pinMode(pwr, OUTPUT);
  pinMode(dpA, OUTPUT);
  pinMode(dpB, OUTPUT);
  pinMode(dpC, OUTPUT);
  pinMode(dpD, OUTPUT);
  _pwr = pwr;
  _dpa = dpA;
  _dpb = dpB;
  _dpc = dpC;
  _dpd = dpD;
}
void skpssc::zero()
{
    digitalWrite(_pwr, HIGH);
    digitalWrite(_dpa, LOW);
    digitalWrite(_dpb, LOW);
    digitalWrite(_dpc, LOW);
    digitalWrite(_dpd, LOW);
    delay(500);
    digitalWrite(_pwr, LOW);
}
void skpssc::one()
{
    digitalWrite(_pwr, HIGH);
    digitalWrite(_dpb, HIGH);
    digitalWrite(_dpb, LOW);
    digitalWrite(_dpc, LOW);
    digitalWrite(_dpd, LOW);
    delay(500);
    digitalWrite(_pwr, LOW);
}
void skpssc::two()
{
    digitalWrite(_pwr, HIGH);
    digitalWrite(_dpa, LOW);
    digitalWrite(_dpb, HIGH);
    digitalWrite(_dpc, LOW);
    digitalWrite(_dpd, LOW);
    delay(500);
    digitalWrite(_pwr, LOW);
}
void skpssc::three()
{
    digitalWrite(_pwr, HIGH);
    digitalWrite(_dpa, HIGH);
    digitalWrite(_dpb, HIGH);
    digitalWrite(_dpc, LOW);
    digitalWrite(_dpd, LOW);
    delay(500);
    digitalWrite(_pwr, LOW);
}
void skpssc::four()
{
    digitalWrite(_pwr, HIGH);
    digitalWrite(_dpa, LOW);
    digitalWrite(_dpb, LOW);
    digitalWrite(_dpc, HIGH);
    digitalWrite(_dpd, LOW);
    delay(500);
    digitalWrite(_pwr, LOW);
}
void skpssc::five()
{
    digitalWrite(_pwr, HIGH);
    digitalWrite(_dpa, HIGH);
    digitalWrite(_dpb, LOW);
    digitalWrite(_dpc, HIGH);
    digitalWrite(_dpd, LOW);
    delay(500);
    digitalWrite(_pwr, LOW);
}
void skpssc::six()
{
    digitalWrite(_pwr, HIGH);
    digitalWrite(_dpa, LOW);
    digitalWrite(_dpb, HIGH);
    digitalWrite(_dpc, HIGH);
    digitalWrite(_dpd, LOW);
    delay(500);
    digitalWrite(_pwr, LOW);
}
void skpssc::seven()
{
    digitalWrite(_pwr, HIGH);
    digitalWrite(_dpa, HIGH);
    digitalWrite(_dpb, HIGH);
    digitalWrite(_dpc, HIGH);
    digitalWrite(_dpd, LOW);
    delay(500);
    digitalWrite(_pwr, LOW);
}
void skpssc::eight()
{
    digitalWrite(_pwr, HIGH);
    digitalWrite(_dpa, LOW);
    digitalWrite(_dpb, LOW);
    digitalWrite(_dpc, LOW);
    digitalWrite(_dpd, LOW);
    delay(500);
    digitalWrite(_pwr, HIGH);
}
void skpssc::nine()
{
    digitalWrite(_pwr, HIGH);
    digitalWrite(_dpa, HIGH);
    digitalWrite(_dpb, LOW);
    digitalWrite(_dpc, LOW);
    digitalWrite(_dpd, HIGH);
    delay(500);
    digitalWrite(_pwr, LOW);
}

i get the error "type is not defined" when i try to include my lib in a sketch.

I have no idea where to go from here as i am still green in programming.

Thanks before hand! :)

You've got many problems. First, you have setup() and loop() defined in the header file. That's nonsense.

Second, you have stuff that diddles with the hardware (pinMode() calls) in the constructor, which is usually called before the hardware is ready to be diddled with.

Third setup() and the constructor are diddling with the same hardware. NOT a good idea.

Fourth, "type not defined" follows the type that is not defined. You didn't bother telling us what the problem really is.