For future wanderers, I finally got it to work using the following (referencing the cmake tutorial and the commands it invokes)
 g++ main.cpp -I/libtorch/include -I/libtorch/include/torch/csrc/api/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++11 -L/libtorch/lib/ -ltorch -lc10 -o output

Don’t forget to add /libtorch/lib/ to LD_LIBRARY_PATH