send location using sim800l and gps neo6mv2

Hi every one … I really need your help )":
I am beginner in this so I will be so thankful for your help

I am trying to send sms location message to my phone using sim800l and gps neo6mv2
I found this code in internet but it has so many errors I have downloaded all library required but it didn’t work, I don’t know why so can you fix this for me or give me another code with the connections for my hardware

thank you all

#include "Arduino.h"
#include "Sim800L.h"
#include<SoftwareSerial.h>
char My_Array[20];
int count = 0;
#define TIME_OUT_READ_SERIAL 5000
String _buffer;
String number = "+123456789";
String text;
SoftwareSerial sim(10,11);
void setup()
{
delay(5000);
Serial.begin(9600);
_buffer.reserve(255);
delay(1000);
sim.begin(9600);
delay(1000);
Serial.println("Setup Complete");
Serial.println("Type s to send sms, c to calculate location");
}
void loop() {
if(Serial.available()>0)
{
switch(Serial.read())
{
case 's':
sendsms("message");
break;
case 'c':
calculateLocation();
break;
}
}
if(sim.available()>0)
{
Serial.println(sim.read());
}
}
String _readSerial()
{
uint64_t timeOld = millis();
while(!Serial.available() && !(millis()> timeOld + TIME_OUT_READ_SERIAL))
{
delay(13);
}
String str;
while(Serial.available())
{
if(Serial.available() > 0) //something is there to be read
{
char C = Serial.read();
if(C == '.')
{
int i = 0;
while (i != count)
{
Serial.print(My_Array[i++]);
}
}
else My_Array[count++] = C;
}
if(Serial.available()>0)
{
str += (char) Serial.read();
}
}
return str;
}
String _readSerial(uint32_t timeout)
{
uint64_t timeOld = millis();
String str;
while(!Serial.available() && !(millis()> timeOld + timeout))
{
if(Serial.available()>0)
{
str += (char) Serial.read();
}
}
return str;
}
void sendsms(String text)
{
Serial.println ("Sending Message");
sim.write("AT+CMGF=1\r");//Sets the GSM Module in Text Mode
delay(1000);
sim.println("AT+CMGF=1");
delay(1000);
sim.write("AT+CMGS=\"+123456789\"");//Mobile phone number to send message
sim.write("\r");
delay(1000);
sim.println(text);
delay(1000);
sim.write(0x1A);
delay(1000);
sim.println((char)26);// ASCII code of CTRL+Z
delay(1000);
_buffer = _readSerial();
}
bool calculateLocation()
{
activateBearerProfile();
Serial.println("activated");
uint8_t type=1;
uint8_t cid=1;
String tmp = "AT+CIPGSMLOC=" + String(type) + "," + String(cid) + "r\n";
sim.print(tmp);
/*sim.write("AT+CIPGSMLOC=");
sim.write(type);
sim.write(",");
sim.write(cid);
sim.write("\r");*/
String data = _readSerial();
Serial.println(data);
if(data.indexOf("ER")!=(-1)) return false;
uint8_t indexOne;
uint8_t indexTwo;
indexOne = data.indexOf(":") + 1;
indexTwo = data.indexOf(",");
String _locationCode = data.substring(indexOne,indexTwo);
Serial.println(_locationCode);
// sendsms(_locationCode);
indexOne = data.indexOf(",")+1;
indexTwo = data.indexOf("," , indexOne);
_longitude = data.substring(indexOne,indexTwo);
sim.print(_longitude);
indexOne = data.indexOf(",", indexTwo) +1;
indexTwo = data.indexOf("," , indexOne);
_latitude = data.substring(indexOne,indexTwo);
sim.print(_latitude);
return true;
}
String getLocationCode()
{
return _locationCode;
}
String getLongitude()
{
return _longitude;
}
String getLatitude()
{
return _latitude;
}
void activateBearerProfile()
{
sim.print(F("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\" \r\n"));
_buffer = _readSerial();
Serial.println(_buffer);
sim.print(F("AT+SAPBR=3,1,\"APN\",\"bsnlnet\" \r\n"));
_buffer = _readSerial();
Serial.println(_buffer);
sim.print(F("AT+SAPBR=1,1 \r\n"));
delay(1200);
_buffer = _readSerial();
Serial.println(_buffer);
sim.print(F("AT+SAPBR=2,1 \r\n"));
delay(3000);
_buffer = _readSerial();
Serial.println(_buffer);
}