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

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 ,%E7%A9%BA%E9%97%B4%EF%BC%8C%E5%AF%BC%E8%87%B4%E5%86%B2%E7%AA%81%E3%80%82

在命名空间前面加c10::

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

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

#undef slots
#include <torch/torch.h>
#include <torch/script.h>
#define slots Q_SLOTS
posted @ 2023-05-01 12:29  乞力马扎罗山的雪  阅读(204)  评论(0)    收藏  举报