Try to use make to compile this test file, no others are needed:
#include <ATen/ATen.h>

int main(){


        at::Tensor a = at::ones({2, 2}, at::kInt);

        return 0;
}

should result in something like:
g++ -std=c++11 -O3 -std=c++11 -I./ -I/usr/local/cuda/include -I/usr/local/anaconda/envs/base3/include/python3.6m -I/usr/local/anaconda/envs/base3/lib/python3.6/site-packages/torch/lib/include -I/usr/local/anaconda/envs/base3/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include -I/usr/local/anaconda/envs/base3/lib/python3.6/site-packages/torch/lib/include/TH -I/usr/local/anaconda/envs/base3/lib/python3.6/site-packages/torch/lib/include/THC -DTORCH_API_INCLUDE_EXTENSION_H -D_GLIBCXX_USE_CXX11_ABI=0  *.cpp
/tmp/ccGWWEwi.o: In function `c10::Device::Device(c10::DeviceType, short)':
a.cpp:(.text._ZN3c106DeviceC2ENS_10DeviceTypeEs[_ZN3c106DeviceC5ENS_10DeviceTypeEs]+0xa4): undefined reference to `c10::Error::Error(c10::SourceLocation, std::string const&)'
a.cpp:(.text._ZN3c106DeviceC2ENS_10DeviceTypeEs[_ZN3c106DeviceC5ENS_10DeviceTypeEs]+0x172): undefined reference to `c10::Error::Error(c10::SourceLocation, std::string const&)'
/tmp/ccGWWEwi.o: In function `c10::intrusive_ptr<at::TensorImpl, at::UndefinedTensorImpl>::reset_()':
a.cpp:(.text._ZN3c1013intrusive_ptrIN2at10TensorImplENS1_19UndefinedTensorImplEE6reset_Ev[_ZN3c1013intrusive_ptrIN2at10TensorImplENS1_19UndefinedTensorImplEE6reset_Ev]+0xe): undefined reference to `at::UndefinedTensorImpl::_singleton'
a.cpp:(.text._ZN3c1013intrusive_ptrIN2at10TensorImplENS1_19UndefinedTensorImplEE6reset_Ev[_ZN3c1013intrusive_ptrIN2at10TensorImplENS1_19UndefinedTensorImplEE6reset_Ev]+0x4f): undefined reference to `at::UndefinedTensorImpl::_singleton'
/tmp/ccGWWEwi.o: In function `main':
a.cpp:(.text.startup+0x47): undefined reference to `caffe2::detail::_typeMetaDataInstance_preallocated_3'
a.cpp:(.text.startup+0x99): undefined reference to `c10::impl::device_guard_impl_registry'
a.cpp:(.text.startup+0x171): undefined reference to `at::native::ones(c10::ArrayRef<long>, at::TensorOptions const&)'
a.cpp:(.text.startup+0x2cb): undefined reference to `c10::operator<<(std::ostream&, c10::DeviceType)'
a.cpp:(.text.startup+0x3d8): undefined reference to `c10::Error::Error(c10::SourceLocation, std::string const&)'
collect2: error: ld returned 1 exit status
Makefile:36: recipe for target 'cpu' failed
make: *** [cpu] Error 1