Imported package not found

Hi All,
I was working on APB template. I created a basic package for test class like this:

package apb_test_pkg;
    	`include "uvm_macros.svh"
   	 import uvm_pkg::*;
	`include "tb_defines.sv"
	`include "apb_base_test.sv"
endpackage: apb_test_pkg

and imported this package in top module like this:

module tb_top();
    	`include "uvm_macros.svh"
   	 import uvm_pkg::*;    
   	 import apb_test_pkg::*;

	bit clk_100MHz;	
	apb_interface apb_intf(clk_100MHz);
	
	initial begin
		forever begin
			#((0.5/`APB_CLK_FREQ) * 1s) clk_100MHz = ~clk_100MHz;
		end
	end

	apb_design DUT (
			.PRESETn(apb_intf.PRESETn),
			.PCLK(clk_100MHz),
			.PSEL(apb_intf.PSEL),
			.PENABLE(apb_intf.PENABLE),
			.PWRITE(apb_intf.PWRITE),
			.PADDR(apb_intf.PADDR),
			.PWDATA(apb_intf.PWDATA),
			.PRDATA(apb_intf.PRDATA),
			.PREADY(apb_intf.PREADY),
			.PSLVERR(apb_intf.PSLVERR)
			);
	initial begin
		uvm_config_db#(virtual apb_interface)::set(null,"*","APB_INTF",apb_intf);
		run_test();
	end
endmodule

but i am getting following error
**# ** Error: …/tb/tb_top/tb_top.sv(7): Could not find the package (apb_test_pkg). Design read will continue, but expect a cascade of errors after this failure. Furthermore if you experience a vopt-7 error immediately before this error then please check the package names or the library search paths on the command line.

** Error: C:/questasim_10.2c/win32/vlog failed.**

If instead of importing the “apb_test_pkg” if i simply include all files of this package in top module it will work. since i already added path of this package in run script but still facing same error, could you guys help me to understand why it is so?

Thanks,
Aaditya Vishal Soni

1 Like

In reply to AadityaVS:
You need to make sure you’ve compiled the package before importing it.
This is most likely a tool usage issue, and this forum is not for tool specific issue.

In reply to dave_59:

Compile clean the package first.

In reply to dave_59:

Hi Dave,
Its working now, Thanks