请问有人知道在Qt中怎么加入这行代码吗,感觉成了未解之谜?
2021.06.18
哈哈哈,直接加到最后竟然就可以了
INCLUDEPATH += your path to\opencv-4.5.0-vc14_vc15\opencv\build\include \
your path to\libtorch17release\include \
your path to\libtorch17release\include\torch\csrc\api\include
LIBS += -Lyour path to\opencv-4.5.0-vc14_vc15\opencv\build\x64\vc15\lib -lopencv_world450 \
-Lyour path to\libtorch17release\lib -lc10 -ltorch -lc10_cuda -lcaffe2_detectron_ops_gpu -lc10d -ltorch_cpu \
-ltorch_cuda -lgloo -lcaffe2_module_test_dynamic -lasmjit -lcaffe2_nvrtc -lclog -lcpuinfo -ldnnl -lfbgemm -lgloo_cuda \
-lmkldnn -INCLUDE:?searchsorted_cuda@native@at@@YA?AVTensor@2@AEBV32@0_N1@Z -INCLUDE:?warp_size@cuda@at@@YAHXZ
参考:https://www.cnblogs.com/allentbky/p/14315040.html
链接器—命令行—其他选项—添加下面两行代码:
/INCLUDE:?searchsorted_cuda@native@at@@YA?AVTensor@2@AEBV32@0_N1@Z
/INCLUDE:?warp_size@cuda@at@@YAHXZ
#include <torch/script.h>
#undef slots
#include <torch/torch.h>
这两行头文件必须放在最前面啊,真是浪费我的时间