Help with Function Definition not allowed here

Getting Errors with Function Definition not allowed here: Below is my code for my PID.cpp

#include "autons.h"
#include "robot-config.h"
#include "vex.h"
#include "functions.cpp"


using namespace vex;


void drivePID(double targetInches, double kP = 0.7, double kI = 0.7, double kD = 1.8) {

  double targetDegrees = inchesToDegrees(targetInches);

  setDTPosition(0); //reset encoders

  double error = targetDegrees;
  double integral = 0;
  double derivative = 0;
  double lastError = 0;
  double maxIntegral = 100;


  while (fabs(error) > 1.0) { //Keep running until you’re within 1° of your target
    double leftAvg = (LF.position(degrees) + LM.position(degrees) + LB.position(degrees)) / 3.0;
    double rightAvg = (RF.position(degrees) + RM.position(degrees) + RB.position(degrees)) / 3.0;
    double avgPos = (leftAvg + rightAvg) / 2.0;

    error = targetDegrees - avgPos;
    integral += error;

    // Anti-windup
    if (integral > maxIntegral) integral = maxIntegral;
    if (integral < -maxIntegral) integral = -maxIntegral;

    derivative = error - lastError;
    lastError = error;

    double power = (kP * error) + (kI * integral) + (kD * derivative);

    // Clamp output
    if (power > 100) power = 100;
    if (power < -100) power = -100;

    spinDT(power*0.7);

    task::sleep(20); // small loop delay
  }


  stopDT();
  Controller1.Screen.print("done");
  Controller1.Screen.print(targetDegrees);

}

//WARNING:kP, kI, and kD values are not correct, need to update yourself
void turnPID(double targetAngle, double kP = 0.1, double kI = 0, double kD = 0) {
  
  double dir =targetAngle/fabs(targetAngle);
  
 
  void turnPID(double targetAngle, double kP, double kI, double kD) {

    double dir = targetAngle/fabs(targetAngle);
    // Reset inertial and motor encoders
    InertialSensor.setRotation(0, degrees);

    // PID state
    double err = targetAngle;
    double integ = 0;
    double deriv = 0;
    double last = 0;
   const double maxI = 50.0;
    targetAngle=fabs(targetAngle);

   targetAngle = fabs(targetAngle);


    // loop til we’re close
    while (fabs(err) > 3.5) {
    while (fabs(err) > 1.0) {
    err = targetAngle - fabs(InertialSensor.rotation(degrees));
    integ += err;
    if (integ >  maxI) integ =  maxI;
    if (integ < -maxI) integ = -maxI;
    deriv = err - last;
    last  = err;

    Controller.Screen.clearScreen();
    Controller.Screen.setCursor(1, 1);
    Controller.Screen.print(InertialSensor.rotation(degrees));

    double power = kP*err + kI*integ + kD*deriv;
    if (power > 100) power = 100;
    if (power < -100) power = -100;

    spinLeftDT(dir*-power);
    spinRightDT(dir*power);

    vex::task::sleep(20);
    }
    }

    controller.Screen.print("done");
    controller.Screen.print(targetAngle);

    stopDT();
  }  
}

Errors are on line void turnPID…
Also getting errors on my functions.cpp:

#include "autons.h"
#include "robot-config.h"
#include "vex.h"
#include "functions.cpp"


using namespace vex;


void drivePID(double targetInches, double kP = 0.7, double kI = 0.7, double kD = 1.8) {

  double targetDegrees = inchesToDegrees(targetInches);

  setDTPosition(0); //reset encoders

  double error = targetDegrees;
  double integral = 0;
  double derivative = 0;
  double lastError = 0;
  double maxIntegral = 100;


  while (fabs(error) > 1.0) { //Keep running until you’re within 1° of your target
    double leftAvg = (LF.position(degrees) + LM.position(degrees) + LB.position(degrees)) / 3.0;
    double rightAvg = (RF.position(degrees) + RM.position(degrees) + RB.position(degrees)) / 3.0;
    double avgPos = (leftAvg + rightAvg) / 2.0;

    error = targetDegrees - avgPos;
    integral += error;

    // Anti-windup
    if (integral > maxIntegral) integral = maxIntegral;
    if (integral < -maxIntegral) integral = -maxIntegral;

    derivative = error - lastError;
    lastError = error;

    double power = (kP * error) + (kI * integral) + (kD * derivative);

    // Clamp output
    if (power > 100) power = 100;
    if (power < -100) power = -100;

    spinDT(power*0.7);

    task::sleep(20); // small loop delay
  }


  stopDT();
  Controller1.Screen.print("done");
  Controller1.Screen.print(targetDegrees);

}

//WARNING:kP, kI, and kD values are not correct, need to update yourself
void turnPID(double targetAngle, double kP = 0.1, double kI = 0, double kD = 0) {
  
  double dir =targetAngle/fabs(targetAngle);
  
 
  void turnPID(double targetAngle, double kP, double kI, double kD) {

    double dir = targetAngle/fabs(targetAngle);
    // Reset inertial and motor encoders
    InertialSensor.setRotation(0, degrees);

    // PID state
    double err = targetAngle;
    double integ = 0;
    double deriv = 0;
    double last = 0;
   const double maxI = 50.0;
    targetAngle=fabs(targetAngle);

   targetAngle = fabs(targetAngle);


    // loop til we’re close
    while (fabs(err) > 3.5) {
    while (fabs(err) > 1.0) {
    err = targetAngle - fabs(InertialSensor.rotation(degrees));
    integ += err;
    if (integ >  maxI) integ =  maxI;
    if (integ < -maxI) integ = -maxI;
    deriv = err - last;
    last  = err;

    Controller.Screen.clearScreen();
    Controller.Screen.setCursor(1, 1);
    Controller.Screen.print(InertialSensor.rotation(degrees));

    double power = kP*err + kI*integ + kD*deriv;
    if (power > 100) power = 100;
    if (power < -100) power = -100;

    spinLeftDT(dir*-power);
    spinRightDT(dir*power);

    vex::task::sleep(20);
    }
    }

    controller.Screen.print("done");
    controller.Screen.print(targetAngle);

    stopDT();
  }  
}

Errors are on 1) void turnForTime line 2) runBottomIntake 3) runTopIntake 4) stopIntake

The errors will usually tell you the line number, and clangd will probably show you where the error is.

Also, do note that you placed PID.cpp twice instead of functions.cpp