Hi,
I am currently trying to use ITensor as library for some tensor network projects. I am working with CLion which relies on CMake. I got the CMake files ready such that my project can find the respective files. However, when I am building my super trivial test code:
#include <iostream>
#include <itensor/all.h>
using namespace itensor;
int main(int argc, char* argv[]) {
return 0;
}
what i get is these error messages (repeated for many times, due to the usage of the function I expect) (here the full log file):
1)
CMakeFiles/tutorial.dir/home/anietner/development/cpp/libraries/itensor/itensor/iqtensor.cc.o: In function `void itensor::detail::OneArg<itensor::CPData>::call<itensor::detail::RegisterTask<itensor::detail::OneArg<itensor::CPData>, itensor::ToITensor&&, itensor::ITensorT<itensor::Index> >, itensor::ToITensor, itensor::Scalar<double>, itensor::ITensorT<itensor::Index> >(itensor::detail::RegisterTask<itensor::detail::OneArg<itensor::CPData>, itensor::ToITensor&&, itensor::ITensorT<itensor::Index> >&, itensor::ToITensor&, itensor::Scalar<double>&, itensor::ManageStore&, itensor::ITensorT<itensor::Index>&)':
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/dotask.h:524: undefined reference to `itensor::typeNameOf(itensor::Scalar<double> const&)'
2)
CMakeFiles/tutorial.dir/home/anietner/development/cpp/libraries/itensor/itensor/itensor_operators.cc.o: In function `void itensor::detail::CallWrap<itensor::detail::RegisterTask<itensor::detail::TwoArgs<std::shared_ptr<itensor::ITData>, itensor::CPData>, itensor::NCProd<itensor::Index>&&, itensor::NoneType>, itensor::NCProd<itensor::Index>, itensor::Scalar<double>, itensor::NoneType, std::shared_ptr<itensor::ITData>, itensor::CPData>::applyToImpl<itensor::Scalar<double> >(itensor::Scalar<double>&)':
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/dotask.h:611: undefined reference to `itensor::typeNameOf(itensor::Scalar<double> const&)'
3)
CMakeFiles/tutorial.dir/home/anietner/development/cpp/libraries/itensor/itensor/iqtensor.cc.o: In function `void itensor::detail::CallWrap<itensor::detail::RegisterTask<itensor::detail::TwoArgs<std::shared_ptr<itensor::ITData>, itensor::CPData>, itensor::AddITensor&&, itensor::NoneType>, itensor::AddITensor, itensor::Dense<double>, itensor::NoneType, std::shared_ptr<itensor::ITData>, itensor::CPData>::applyToImpl<itensor::Scalar<std::complex<double> > const>(itensor::Scalar<std::complex<double> > const&)':
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/dotask.h:612: undefined reference to `itensor::typeNameOf(itensor::Scalar<std::complex<double> > const&)'
The CMake file can be found here
Maybe someone can help me and tell me how to fix this :) ?
EDIT:
Maybe this is of interest to the question: As one can see I do not include the files itlazy.h
and itlazy.cc
. This is because if I do so and build the project I get the following errors (full log file):
1)
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc:14:25: error: ‘ITReal’ does not name a type
doTask(PrintStore,const ITReal& R) { println("Storage type of P is ITReal"); }
2)
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc: In function ‘itensor::PData itensor::evaluate(itensor::ITLazy&)’:
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc:81:25: error: ‘using IndexSetBuilder = class itensor::RangeBuilderT<itensor::IndexSetT<itensor::Index> >’ has no member named ‘setExtent’
cis.setExtent(cn++,In);
3)
In file included from /home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.h:9:0,
from /home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc:1:
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itdata.h: In instantiation of ‘class itensor::ITWrap<itensor::ITLazy>’:
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itdata.h:262:9: required from ‘StorageT* itensor::ManageStore::makeNewData(VArgs&& ...) [with StorageT = itensor::ITLazy; Args = {const itensor::ITLazy&}]’
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc:178:39: required from here
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itdata.h:81:5: error: static assertion failed: Data type not in list of registered storage types
static_assert(containsType<StorageTypes,stdx::decay_t<T>>{},"Data type not in list of registered storage types");
^
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itdata.h: In instantiation of ‘void itensor::ITWrap<T>::plugInto(itensor::FuncBase&) const [with T = itensor::ITLazy; itensor::FuncBase = itensor::FuncBaseT<itensor::TypeList<itensor::Dense<double>, itensor::Dense<std::complex<double> >, itensor::Combiner, itensor::Diag<double>, itensor::Diag<std::complex<double> >, itensor::QDense<double>, itensor::QDense<std::complex<double> >, itensor::QCombiner, itensor::QDiag<double>, itensor::QDiag<std::complex<double> >, itensor::QMixed<double>, itensor::QMixed<std::complex<double> >, itensor::Scalar<double>, itensor::Scalar<std::complex<double> > > >]’:
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc:182:1: required from here
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itdata.h:104:9: error: no matching function for call to ‘itensor::FuncBaseT<itensor::TypeList<itensor::Dense<double>, itensor::Dense<std::complex<double> >, itensor::Combiner, itensor::Diag<double>, itensor::Diag<std::complex<double> >, itensor::QDense<double>, itensor::QDense<std::complex<double> >, itensor::QCombiner, itensor::QDiag<double>, itensor::QDiag<std::complex<double> >, itensor::QMixed<double>, itensor::QMixed<std::complex<double> >, itensor::Scalar<double>, itensor::Scalar<std::complex<double> > > >::applyTo(const itensor::ITLazy&)’
f.applyTo(d);