Create a new library

Hello everyone, I am a novice of Arduino and Platformio, also I tell you that I am Italian and since I have a bit of difficulty with English I am writing to you via google translator.
I am trying to learn, through web searches, to write a small library with the relative file .h .cpp and keyword.txt, and I am attaching the codes below

File .h

#ifndef Morse_h
#define Morse_h

#include "Arduino.h"

class Morse {// the class is defined
   public:
      Morse (int pin);
      void dot ();
      void dash ();
   private:
      int _pin;
};
#endif

File .cpp

#include "Arduino.h"
#include "Morse.h"

Morse :: Morse (int pin) {
pinMode (pin, OUTPUT);
_pin = pin;
}

void Morse :: dot () {
digitalWrite (_pin, HIGH);
delay (250);
digitalWrite (_pin, LOW);
delay (250);
}

void Morse :: dash () {
digitalWrite (_pin, HIGH);
delay (1000);
digitalWrite (_pin, LOW);
delay (250);
}

File Keyword

Morse KEYWORD1
dash KEYWORD2
dot KEYWORD2

But if I compile these files through the arduino IDE everything works, while if I compile it with platformio, I write this error here

C: \ Users \ MOSBON ~ 1 \ AppData \ Local \ Temp \ ccNHvu7R.ltrans0.ltrans.o: In function main ': <artificial> :(. text.startup + 0x8e): undefined reference to Morse :: dot () ’
:(. text.startup + 0x96): undefined reference to Morse :: dot () ' <artificial> :(. text.startup + 0x9e): undefined reference to Morse :: dot () ’
:(. text.startup + 0xa6): undefined reference to Morse :: dash () ' <artificial> :(. text.startup + 0xae): undefined reference to Morse :: dash () ’
:(. text.startup + 0xb6): undefined reference to Morse :: dash () ' <artificial> :(. text.startup + 0xbe): undefined reference to Morse :: dot () ’
:(. text.startup + 0xc6): undefined reference to Morse :: dot () ' <artificial> :(. text.startup + 0xce): undefined reference to Morse :: dot () ’
C: \ Users \ MOSBON ~ 1 \ AppData \ Local \ Temp \ ccNHvu7R.ltrans0.ltrans.o: In function _GLOBAL__sub_I_morse ': <artificial> :(. text.startup + 0x134): undefined reference to Morse :: Morse (int) ’
collect2.exe: error: ld returned 1 exit status
*** [.pio \ build \ uno \ firmware.elf] Error 1

Can you help me please?
Thanks to everyone who dedicated some time to me

Sorry I forgot to enter the sketch code

#include "Arduino.h"

#include <Morse.h>

Morse morse(13);

void setup(){

}

void loop(){

morse.dot();

morse.dot();

morse.dot();

morse.dash();

morse.dash();

morse.dash();

morse.dot();

morse.dot();

morse.dot();

delay(3000);

}

Can you show a screenshot of the folder structure in VSCode? I don’t see an error in your code.

include/ folder is for .h files only – the CPP files in there will not be compiled.

You should create a new folder in lib (e.g. Morse) and put the 3 files in there.

(Also, the keyword.txt file is not processed by PlatformIO, only by the Arduino IDE).