Libtorch throws some errors when using toghether with qt, pcl and opencv

I am trying to use libtorch, qt widgets, point cloud library(pcl) and opencv in a project. For this project I am using cmake lists. The issue is that when I am using all four libraries together errors are thrown by libtorch. If I use libtorch, opencv and qt everything works fine, also if I use pcl qt and opencv everything also works well. The errors that I get are listed bellow:

  1. /libtorch/include/torch/csrc/jit/api/object.h: In member function ‘size_t torch::jit::Object::num_slots() const’:
    /libtorch/include/torch/csrc/jit/api/object.h:173:28: error: expected unqualified-id before ‘(’ token 173 return _ivalue()->slots().size();
  2. /libtorch/include/ATen/core/ivalue_inl.h: In member function ‘c10::intrusive_ptr c10::IValue::toCustomClass() const &’:
    /libtorch/include/ATen/core/ivalue_inl.h:1642:3: error: expected unqualified-id before ‘(’ token
    1642 | TORCH_CHECK(
  3. /libtorch/include/ATen/core/ivalue_inl.h: In member function ‘c10::intrusive_ptr c10::IValue::toCustomClass() &&’:
    /libtorch/include/ATen/core/ivalue_inl.h:1624:3: error: expected unqualified-id before ‘(’ token
    1624 | TORCH_CHECK(
    | ^~~~~~~~~~~
  4. /libtorch/include/ATen/core/ivalue_inl.h:1419:36: error: expected unqualified-id before ‘)’ token
    1419 | const std::vector& slots() const {

Does anyone know why libtorch is trowing these errors?