Please download the zip version of libtorch. Then try this.
install_root = ‘/xxx/yyy/zzz/libtorch’ which is the path or libtorch
g++ example-app.cpp -I${install_root}/include -I${install_root}/include/torch/csrc/api/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++14 -L${install_root}/lib -Wl,-R${install_root}/lib -ltorch -ltorch_cpu -lc10 -o example-app