Uvm_callback

i am trying to implement uvm_callback but the error is

ncvlog: *E,SVNOTY (callback.sv,20|53): Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope.
(define macro: uvm_do_obj_callbacks [/chicago/tools/cadence/INCISIV15.20/tools.lnx86/methodology/UVM/CDNS-1.2-ML/sv/src/macros/uvm_callback_defines.svh line 162], define macro: uvm_do_callbacks [/chicago/tools/cadence/INCISIV15.20/tools.lnx86/methodology/UVM/CDNS-1.2-ML/sv/src/macros/uvm_callback_defines.svh line 139], file: callback.sv line 20)
`uvm_do_callbacks(driver,driver_callback,post_send())

can anyone help me where is the problem?





`include "uvm_macros.svh"
import uvm_pkg::*;

module test;


class driver extends uvm_driver;
`uvm_component_utils(driver)

`uvm_register_cb(driver,driver_callback)

function new (string name, uvm_component parent = null);
super.new(name,parent);
endfunction

virtual task run_phase(uvm_phase phase);
phase.raise_objection(this);
repeat(2)
  begin
  `uvm_do_callbacks(driver,driver_callback,pre_send())   //getting error here
  $display("driver : started driving the packet  %d",$time);
	#40;
  $display("driver : finished driving the packet  %d",$time);
  `uvm_do_callbacks(driver,driver_callback,post_send())  //getting error here
  end
phase.drop_objection(this);
endtask

endclass


class driver_callback extends uvm_callback;

function new (string name = "driver_callback"); 
super.new(name);
endfunction

static string type_name = "driver_callback";

virtual function string get_type_name();
return type_name;
endfunction

virtual task pre_send(); endtask
virtual task post_send();endtask
endclass



class custom_driver_callback extends driver_callback;

function new (string name = "driver_callback");
super.new(name);
endfunction


virtual task pre_send();
$display("pre send : delay the packet drive by 20 time unit %d",$time);
#20;
endtask

virtual task post_send();
$display("just a message from post send callback method \n");
endtask

endclass


initial begin
driver drv;
custom_driver_callback cb_1;
drv = new("drv");
cb_1 = new("cb_1");

uvm_callbacks #(driver,driver_callback)::add(drv,cb_1);
uvm_callbacks #(driver,driver_callback)::display();
run_test();
end
endmodule


In reply to Amarjit pradhan:
You are trying to register callbacks classes that have not been defined yet. You need to change the order of your class definitions, or use a forward typedef,