Try Make Lib Fail

I’m trying to make my frist lib in arduino, but it dont work give me an error:

In function __static_initialization_and_destruction_0':* *C:\Users\Paic\Desktop\SOFTWARE MAKING\Arduino\arduino-1.0.5/COM_Comunicating_Test.ino:3: undefined reference to Pin::Pin(unsigned char)’

In the include dir i have make this 2 FILES:


#ifndef PIN_H
#define PIN_H
#include <Arduino.h>
#include <inttypes.h>

class Pin

           Pin(uint8_t pin);
           bool State;
           bool OldState;
           uint8_t PulseF;
           bool PulseONOFF;
           bool ForceSet;
           bool ForceState;

//main func
           void Write(bool state);
           bool Read();
           void Loop();

//extra func
            void SetPulseHZ(uint8_t HZ);
            void Pulse(bool state);
            bool FrontPositive();
            bool FrontNegative();
            void WriteForced(bool enable, bool state);
            void WriteForced(bool enable);

        uint8_t PinS;
        uint8_t Time;


#endif // PIN_H


#include "Pin.h"

Pin::Pin(uint8_t pin)
    this->PinS = pin;
    this->State = false;
    this->OldState = false;
    this->PulseF = 0;
    this->ForceSet = false;
    this->ForceState = false;

bool Pin::Read(){
    if (digitalRead(PinS)){
        return true;
        return false;

void Pin::Write(bool state){
    this->State = state;

//setup loop
void Pin::Loop(){

    if (this->ForceSet){
     this->State = this->ForceState;
     this->State = this->Read();
    this->OldState = this->State;


//front positive __|
bool Pin::FrontPositive(){
    if (this->Read() && !this->OldState){
        this->OldState = true;
        this->State = true;
        return true;
        return false;
//front positive |___
bool Pin::FrontNegative(){
    if (!this->Read() && this->OldState){
        this->OldState = false;
        this->State = false;
        return true;
        return false;

//setup pulse freq
void Pin::SetPulseHZ(uint8_t HZ){
    this->PulseF = 1000/HZ;
//start /stop pulse
void Pin::Pulse(bool state){
    this->PulseONOFF = state;
    if (state){
        this->Time = millis();

//force write
void Pin::WriteForced(bool enable, bool state){
    this->ForceSet = enable;
    this->ForceState = state;
void Pin::WriteForced(bool enable){
    this->ForceSet = enable;

In the include dir

The include dir?

Where is your sketch? How are we supposed to reproduce your problem, without all the files?

Sorry the "include dir" is the path of the file Pin.h (library)

up sorry but 0 help :(

up sorry but 0 help :frowning:

You’re being 0 help in giving you any help. You need to post all the code. The error isn’t always where you think it is.

The error is usually where the compiler thinks it is though. And the compiler is telling you…

In function __static_initialization_and_destruction_0': C:\Users\Paic\Desktop\SOFTWARE MAKING\Arduino\arduino-1.0.5/<mark>COM_Comunicating_Test.ino</mark>:3: undefined reference to Pin::Pin(unsigned char)’

that the error is in the test program that you aren’t showing us.

kingpaic: up sorry but 0 help :(

How to use this forum