Function not declared in scope



  • @void MainWindow::update_values(double seek)
    {
    ui->doubleSpinBox_19->setValue(seek);
    }

    double goal_seek (double goal, double bound_lower, double bound_upper, double seek) {
    seek = (bound_upper - bound_lower) / 2;
    double goalseek;
    update_values(seek);
    if (abs(goalseek - goal) <= 0.0001)
    return seek;
    else if (goalseek < goal) {
    bound_lower = goalseek;
    return goal_seek(goal, bound_lower, bound_upper, seek);
    }
    else if (goalseek > goal){
    bound_upper = goalseek;
    return goal_seek(goal, bound_lower, bound_upper, seek);
    }
    else
    return -1;
    }

    void MainWindow::button_pushed()
    {
    double seek;
    goal_seek(5);
    update_values(seek);
    }@

    In the function "goal_seek", I want to call a function called update_values. However that line gives an error message saying update_values was not declared in scope.

    I dont see why this is so. Above it, one may see the function declaration.

    More confusing still is the fact that if I call update_values from the function button_pushed() there is no error message saying its not declared in scope.

    Can anyone suggest how to take away the error message?



  • Yes, as update_values() is a member of your class MainWindow, while goal_seek() is a global function.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.