How to include library on core folder

Hello all.
I have a custom library called StringWrite (derived from SD library) that I want to put on minima core folder like this
image
the content:
image
utility folder content
image

StringWrite.cpp

#include "StringWrite.h"

File myFile;

short int StringWrite(String fichier, String phrase){
  

  phrase = phrase + '\n'; //controle de la longueur fait par les fonctions ?


  if (!SD.begin(4)) { // PIN PAR DEFAUT DU SD dans src/utility/Sd2Card.h --- en lien avec "pin_arduino.h" -> a renommer plus tard par pin_yamr64a
    //Serial.println("initialization failed!");
    return -1;
  }

  myFile = SD.open(fichier, FILE_WRITE);

  if (myFile) {//si myFile==true = si fichier ouvert sans erreur
    //Serial.print(phrase);
    myFile.print(phrase);
    myFile.close();
    //Serial.println("done.");
    return 1;
  } 
  else {return 0;}

}

and StringWrite.h

#ifndef STRINGWRITE_H
#define STRINGWRITE_H

// #include "String.h"
#include "SPI.h"
#include "SD.h"


short int StringWrite(String fichier, String phrase);


#endif // FIN

But, the problem is when I try to test the function, I got this compilation error

So I tried to manually add the "SPI" path library folder on my StringWrite.h file ("../../libraries/SPI/SPI.h") and I got this time lot of error:

The thing I don't understand is that, when I decide to put my custom library folder on the default Arduino Library folder, everything goes right, compilation success.

So I have the feeling that SPI folder and other make problem when I put my function on arduino cores, but my programming level is not enought to understand why.

So need help to solve it please.

EDIT: this is my file
StringWrite.zip (49,1 Ko)

Why does the library need to go into the minima core folder rather than the standard libraries folder ?

Because I soldered an SD card slot on my minima, so I'll use everytime this function. So I want to make this function a default one, like function we see on core folder

it uses other libraries SPI and SD. core can't use libraries.

so there is no solution to make core use libraries ?
maybe @ptillisch have a solution for it ?

Ha, thank you @Delta_G

That is what I didn't get !

I think the big problem is I don't understand what is the difference between the core and libraries standard folder, because There is also a library folder in the cores folder... how does it works.

And how can we change core libraries if these libraries should not be modified ?

I'm a bit confused now.

So I have to make invesgation about that.
Thanks !

Thank you very much for taking the time to explain all this. It's very clear now.
For sure, I won't anymore look at modifying this core files.
It make sens know with all your explanation.

This is what I expect for people who have knowledge, to take the time to explain why someone is going to the wrong side.
Behaviour of ones who only answer to question by how to NOT do what you asked, doesn't help anyone. Nobody can progress with this kind of behaviour.
Thanks

Thank You for saying that. That shed some light for me as well. Now some things make more sense.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.