vs2017调用libtorch 报一堆错误
时间:2020-07-07 20:42:00
收藏:0
阅读:393
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 C7525 内联变量至少需要 "/std:c++17" libtorch-win-shared-with-deps-1.5.1\libtorch\include\c10\util\bfloat16-inl.h 66
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 C2365 “std::c10::BFloat16”: 重定义;以前的定义是“函数” libtorch-win-shared-with-deps-1.5.1\libtorch\include\c10\util\bfloat16-inl.h 66
解决办法:
include的顺序问题
错误顺序
#include <torch/torch.h>
#include <torch/script.h> // One-stop header.
#include <opencv2/opencv.hpp>
#include <string>
#include <vector>
#include <memory>
正确顺序
#include <opencv2/opencv.hpp>
#include <string>
#include <vector>
#include <memory>
#include <torch/torch.h>
#include <torch/script.h> // One-stop header.
原文:https://www.cnblogs.com/xdk1002/p/13262453.html
评论(0)