Can't use part of conarlib files

Hi, I have a problem with the trackers, I installed the contrib folder, I can access the tracking_legacy.hpp file but not use its classes, but tracking.hpp working, what could be the problem?
I use opencv 4.9.0

a specific error message would help.

please browse the official documentation to learn which headers you need and which namespaces contain which classes and functions.

using modules from contrib requires building opencv with those modules. the contrib/modules directory needs to be announced to cmake as a variable. details can be found in the documentation.

1>------ Build started: Project: Yolo5, Configuration: Debug x64 ------
1>Yolo5.cpp
1>C:\Users\The user\opencv_contrib\modules\tracking\include\opencv2\tracking.hpp(17,27): error C2871: ‘legacy’: a namespace with this name does not exist
1>C:\Users\The user\Documents\practicum\Yolo5\Yolo5.cpp(42,22): error C2653: ‘TrackerBoosting’: is not a class or namespace name
1>C:\Users\The user\Documents\practicum\Yolo5\Yolo5.cpp(42,39): error C3861: ‘create’: identifier not found
1>C:\Users\The user\Documents\practicum\Yolo5\Yolo5.cpp(48,23): error C2653: ‘TrackerTLD’: is not a class or namespace name
1>C:\Users\The user\Documents\practicum\Yolo5\Yolo5.cpp(48,35): error C3861: ‘create’: identifier not found
1>C:\Users\The user\Documents\practicum\Yolo5\Yolo5.cpp(50,23): error C2653: ‘TrackerMedianFlow’: is not a class or namespace name
1>C:\Users\The user\Documents\practicum\Yolo5\Yolo5.cpp(50,42): error C3861: ‘create’: identifier not found
1>C:\Users\The user\Documents\practicum\Yolo5\Yolo5.cpp(54,23): error C2653: ‘TrackerMOSSE’: is not a class or namespace name
1>C:\Users\The user\Documents\practicum\Yolo5\Yolo5.cpp(54,37): error C3861: ‘create’: identifier not found
1>C:\Users\The user\Documents\practicum\Yolo5\Yolo5.cpp(93,19): warning C4244: ‘initializing’: conversion from ‘double’ to ‘float’, possible loss of data
1>Done building project “Yolo5.vcxproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

#include <opencv2/video/tracking.hpp>
#include <opencv2/core/ocl.hpp>
#include <opencv2/video/tracking.hpp>
#include <modules/tracking/include/opencv2/tracking.hpp>
#include<modules/tracking/include/opencv2/tracking/tracking_legacy.hpp>

When I open the file tracking_legacy.hpp, it contains all the classes it can’t find, why doesn’t it work for me?

you need to make sure that your copies (clones) of both the main and contrib repository are checked out to the same branch or tag (version tag).

those do not look correct at all.

use the documentation.

https://docs.opencv.org/4.x/dc/d6b/group__tracking__legacy.html