Using the MIDI library in my own library Error message :

"error: invalid declarator before 'MIDI'
         MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);
                                                       ^
Plusieurs bibliothèque trouvées pour "libMidi.h"
/home/due32/Arduino/libraries/MIDI/midi_Defs.h:170:31: note: in definition of macro 'MIDI_CREATE_INSTANCE'
     midi::MidiInterface&lt;Type&gt; Name((Type&amp;)SerialPort);"




libMidi.h

#ifndef libMidi_h
#define libMidi_h

#include &lt;Arduino.h&gt;
#include &lt;MIDI.h&gt;



    void midiSetup();
    void pmbMIDI();

//  void MIDI_CREATE_DEFAULT_INSTANCE(); //doesn't work

#endif




libMidi.cpp

#include "libMidi.h"
#include &lt;MIDI.h&gt;

void midiSetup(){

//midi::MidiInterface&lt;Type&gt; Name((Type&amp;)SerialPort);

        void MIDI_CREATE_DEFAULT_INSTANCE();
        void MIDI.begin(MIDI_CHANNEL_OMNI);
}

void pmbMIDI(){
    if (MIDI.getType() == 144){
        digitalWrite(13, 1);}

    if (MIDI.getType() == 128){
        digitalWrite(13, 0);}
}




Thank you by advance
void MIDI_CREATE_DEFAULT_INSTANCE();


This line should not be placed inside a function, because it is a forward function declaration.

However, I think there are more problems in your code.

My wild guess is to improve the following lines:


Uncomment line that doesn't work


Change

MIDI_CREATE_DEFAULT_INSTANCE();


to

MIDI_CREATE_DEFAULT_INSTANCE();


and place it outside a function.

Remove the word void  in the following lines

void midiSetup();
void pmbMIDI();


And also align the { and } 

void MIDI.begin(MIDI_CHANNEL_OMNI);


So it's a function call.

Other improvements is to remove spaces or tabs  in

    void midiSetup();
    void pmbMIDI();


Also align { and } in

if (MIDI.getType() == 144){
    digitalWrite(13, 1);}

if (MIDI.getType() == 128){
    digitalWrite(13, 0);}