#include <TH/TH.h>

How can I link to the TH file in the c code ?

I use Clion, and confuse about how to link the TH file (install from source) and test some function in it .
Where is the file and how to add it in CMakeLists.

Thank you

you may refer to https://apaszke.github.io/torch-internals.html

# clone Torch repository
git clone https://github.com/torch/torch7
mkdir th_build
cd th_build
# configure TH build
cmake ../torch7/lib/TH
# compile library
make
# install shared library and header files
make install

Then, you only have to #include <TH/TH.h> in your program and link the library during the compilation process (-lTH).

Thank you @chenyuntc. Your suggestion is right. However, is there possible to link the build pytorch libraries ? (maybe I am too stubborn)

I build ATen separately, it can also work.

Thank you again~

I don’t know much about C/C++, but I guess if you add the build libraries(libTH.so) to your path and link it (-l TH) during the compilation process, it shall work.