Jetson nano OpenCV cuda::getCudaEnabledDeviceCount() return 0

I have build OpenCV with WITH_CUDA=ON based on

With some changes as below successfully:

  1. commented out the line
    sudo apt-get dist-upgrade -y --autoremove
    as it upgraded JetPack 4.4.0 to 4.4.1 which resulted the e-con system camera does not work.
  2. added:
    as I am using Qt Creator for coding and debugging.

But the line below return 0 during my test
int count = cuda::getCudaEnabledDeviceCount();

No CUDA enabled device is available, why?
How to fix it?

Your application may be running the old version of opencv.

std::cout << cv::getBuildInformation() << std::endl;

for checking what the running version of opencv supports.

Thank you for your help.
Yes. you are right.
The newly build OpenCV does not overwrite the previous OpenCV installation.
The newly build OpenCV installed at /usr/local/