The downloaded package is libtorch-win-shared-with-deps-2.3.0+cpu. It loads normally on the local Visual Studio, but when the corresponding lib library is added to the .pro file of Qt, along with the corresponding header files, and after referencing #include “torch/script.h”, compilation errors occur. The error messages are as follows:
- D:\software\libtorch\include\ATen\core\ivalue_inl.h:1572: error: C2059: syntax error: “”
- D:\software\libtorch\include\ATen\core\ivalue_inl.h:1572: error: C2334: unexpected token before ‘{’; skipping apparent function body
- D:\software\libtorch\include\ATen\core\ivalue_inl.h:1788: error: C2760: syntax error: unexpected token ‘(’; expected ‘ID expression’ D:\software\libtorch\include\ATen/core/ivalue_inl.h(1788): error C2760: syntax error: unexpected token ‘(’; expected ‘ID expression’ D:\software\libtorch\include\ATen/core/ivalue.h(500): note: This diagnostic occurred in the compiler generated function “c10::intrusive_ptr<T,c10::detail::intrusive_target_default_null_type> c10::IValue::toCustomClass(void) &&”.