【c++】libtorch和qt和opencv部署

发布时间 2023-05-01 12:35:27作者: 乞力马扎罗山的雪

https://blog.csdn.net/rglkt/article/details/125508634

opencv和libtorch的兼容问题,只需要下载(cxx11 ABI)即可

关于slot报错问题:
引入torch文件时使用这种办法

#undef slots
#include <torch/torch.h>
#include <torch/script.h>
#define slots Q_SLOTS

命名空间的问题
参考这个:https://blog.csdn.net/qq_51993578/article/details/119850138#:~:text=由于要同时使用o,空间,导致冲突。

在命名空间前面加c10::

最关键的一点
https://blog.csdn.net/Hurryhao_Alin/article/details/124655386

将以下内容放在所有头文件之前,能编译通过

#undef slots
#include <torch/torch.h>
#include <torch/script.h>
#define slots Q_SLOTS