【发布时间】:2022-06-10 17:50:53
【问题描述】:
我正在尝试在项目中使用 libtorch、qt 小部件、点云库 (pcl) 和 opencv。对于这个项目,我正在使用 cmake 列表。问题是当我同时使用所有四个库时,libtorch 会抛出错误。如果我使用 libtorch、opencv 和 qt 一切正常,如果我使用 pcl qt 和 opencv 一切也都很好。下面列出了我得到的错误:
/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();
/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(
/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(
| ^~~~~~~~~~~
/libtorch/include/ATen/core/ivalue_inl.h:1419:36: error: expected unqualified-id before ‘)’ token
1419 | const std::vector& slots() const {
有人知道为什么 libtorch 会抛出这些错误吗?
【问题讨论】:
-
你能发布你的 CMakeLists.txt 吗?
标签: c++ opencv qt-creator point-cloud-library libtorch