Help with servo speed control?

I came across ‘Ramp.h’ on Github and though it could be useful in controlling the position and speed of a servo when combined with the PWMServo driver.
My knowledge of C+ is quite limited so I would be very grateful on some guidance as to why the code below will not function?
Many thanks.

#include <Ramp.h>

int x;                       
unsigned long time_now = 0;   
unsigned long time_start = 0;   
bool target_reached = false;   
int target = 100;             
int duration = 1000;           
rampInt myRamp;

void setup() {
  Serial.begin(9600);
}

void loop() {
  time_start = millis();
  myRamp.go(target, duration);  //Start ramping up to target through our defined duration
 
  x = myRamp.update();           // Get the current position
     
  Serial.println(x);
  if (x == target) {             // if target is reached print out duration and set target_reached flag to true
    time_now = millis();
    Serial.println("Target reached");
    Serial.println(x);
    Serial.print(time_now - time_start);
    Serial.print(" milli seconds");
    target_reached = true;   // Target has now been reached, stop printing out to Serial
    }
}

Because time_start and myRamp.go() are done everytime round loop()? Put those two lines in setup() perhaps?

Its C++, not C+.

What I need to do is to repeatedly update the the ramp settings with new 'target' and 'durations' which I cant do if its in the 'setup'? Thanks for your help.