Unable to use libtorch with C++

F:/sigma/sigma/3rdparty/libtorch/include/c10/core/DynamicCast.h: In function ‘dest_t c10::fetch_and_cast(c10::ScalarType, const void*) [with dest_t = c10::qint8]’:
F:/sigma/sigma/3rdparty/libtorch/include/c10/macros/Macros.h:401:5: error: ‘__assert_fail’ was not declared in this scope
401 | __assert_fail(
| ^~~~~~~~~~~~~

Codes:
#include
#include <torch/script.h>

using namespace std;

int main() {
torch::Tensor tensor = torch::rand({3, 3});
torch::Tensor tensor1 = torch::zeros({5, 5});
cout << tensor << endl << tensor1 << endl;

return 0;

}

Windows11
libtorch-2.4.0-cpu
How to compiler this file?

I compiled it with VS 2019, on Win 11.

#include <torch/torch.h>               // torch

Output:

 0.2519  0.6636  0.9867
 0.1741  0.1896  0.6346
 0.4020  0.5482  0.3991
[ CPUFloatType{3,3} ]
 0  0  0  0  0
 0  0  0  0  0
 0  0  0  0  0
 0  0  0  0  0
 0  0  0  0  0
[ CPUFloatType{5,5} ]