Hi All,
I was trying to add the libtorch library to our project which is being build by using g++ or visual studio (it’s a multiplatform project) now I was trying to include the specified files in the g++ command but it does not seem to work, or I’m doing something wrong or the files are not meant to be included this way into a compliler.
I used the standard (most simple) example taken from: https://pytorch.org/cppdocs/installing.html#minimal-example
then I tried to use the command: g++ -std=c++17 -o test *.cpp -I /home/user/libtorch/include/ -L /home/user/libtorch/lib/
but I got the error:
example-app.cpp:1:10: fatal error: torch/torch.h: No such file or directory
#include <torch/torch.h>
The cmake example worked great, but writing the cmake for the entire project will take quite some time (especially since I have never done it before), so my question is if there is any way to use the libtorch in a way described above, with a normal compiler?
Any help would be greatly appreciated!
EDIT:
When I just posted this I found the other include directory in the api folder, and I managed to compile it perfectly after that
If other people might be interested this is the command I used:
g++ -std=c++17 -o test *.cpp -I /home/user/libtorch/include/torch/csrc/api/include/ -I /home/user/libtorch/include/ -L /home/user/libtorch/lib/ -lc10 -lcaffe2 -ltorch -D_GLIBCXX_USE_CXX11_ABI=0