glaringlee:

What I recommend to do is download libtorch zip package and follow the instruction here:


**Thank you for the detailed answer. **
I followed all the instructions you shared with me and did it successfully. I used CMake, built and loaded my model got input and output via CPP on my PC.
I would like to include torch/script.h in my existing CPP Android project, so I can load my model and execute it from my exisiting code.
I added to my Andorid.mk file the shared libraries you mentioned + the includes above.
LOCAL_LDLIBS += -L$(TORCH_REPO_PATH)/lib -ltorch -ltorch_cpu -lc10 -ltorch_global_deps
I’m still getting these errors:
C:\REPOS\CPU\libtorch-shared-with-deps-latest\libtorch/include\torch/csrc/jit/ir/ir.h:67:17: error: no namespace named ‘prim’ in namespace ‘c10’; did you mean simply ‘prim’?
using namespace ::c10::prim;
^~~~~~~~~~~
prim
C:\REPOS\CPU\libtorch-shared-with-deps-latest\libtorch/include\torch/csrc/jit/ir/ir.h:66:11: note: namespace ‘prim’ defined here
namespace prim {
^
C:\REPOS\CPU\libtorch-shared-with-deps-latest\libtorch/include\torch/csrc/jit/ir/ir.h:70:17: error: no namespace named ‘attr’ in namespace ‘c10’; did you mean simply ‘attr’?
using namespace ::c10::attr;
^~~~~~~~~~~
attr
C:\REPOS\CPU\libtorch-shared-with-deps-latest\libtorch/include\torch/csrc/jit/ir/ir.h:69:11: note: namespace ‘attr’ defined here
namespace attr {
^
C:\REPOS\CPU\libtorch-shared-with-deps-latest\libtorch/include\torch/csrc/jit/ir/ir.h:73:17: error: no namespace named ‘aten’ in namespace ‘c10’; did you mean simply ‘aten’?
using namespace ::c10::aten;
^~~~~~~~~~~
aten
C:\REPOS\CPU\libtorch-shared-with-deps-latest\libtorch/include\torch/csrc/jit/ir/ir.h:72:11: note: namespace ‘aten’ defined here
namespace aten {
^
C:\REPOS\CPU\libtorch-shared-with-deps-latest\libtorch/include\torch/csrc/jit/ir/ir.h:1309:34: error: no member named ‘prim’ in namespace ‘c10’; did you mean simply ‘prim’?
static constexpr Symbol Kind = ::c10::prim::profile;
^~~~~~~~~~~
prim
C:\REPOS\CPU\libtorch-shared-with-deps-latest\libtorch/include\torch/csrc/jit/ir/ir.h:66:11: note: ‘prim’ declared here
namespace prim {
^
C:\REPOS\CPU\libtorch-shared-with-deps-latest\libtorch/include\torch/csrc/jit/ir/ir.h:1309:47: error: no member named ‘profile’ in namespace ‘torch::jit::prim’
static constexpr Symbol Kind = ::c10::prim::profile;
^
C:\REPOS\CPU\libtorch-shared-with-deps-latest\libtorch/include\torch/csrc/jit/ir/ir.h:1311:21: error: no member named ‘prim’ in namespace ‘c10’; did you mean simply ‘prim’?
: Node(graph, ::c10::prim::profile), callback_(callback) {}
^~~~~
prim
C:\REPOS\CPU\libtorch-shared-with-deps-latest\libtorch/include\torch/csrc/jit/ir/ir.h:66:11: note: ‘prim’ declared here
namespace prim {
^
C:\REPOS\CPU\libtorch-shared-with-deps-latest\libtorch/include\torch/csrc/jit/ir/ir.h:1311:34: error: no member named ‘profile’ in namespace ‘torch::jit::prim’
: Node(graph, ::c10::prim::profile), callback_(callback) {}
~~~~~~^
7 errors generated.
What am I missing?