I have tried to program a header-only library for an existing project. The compiler has no error (anymore), but the linker (clang) failed...
I am using CMake and my library is added with the following lines:
set(RODE_DIR rode) include_directories (${RODE_DIR}) The error is the following:
Undefined symbols for architecture x86_64: "sfm::StreamlineWrf::ComputeStreamline(sfm::NdArray<float>*, sfm::NdArray<float>*, sfm::NdArray<float>*, sfm::NdArray<float>*, int&, int&, int&, double const*, int, double, std::__1::vector<double, std::__1::allocator<double> >*)", referenced from: _main in wrf2sl.cc.o "sfm::ijktos(sfm::NdArray<float>*, sfm::NdArray<float>*, sfm::NdArray<float>*, int const*, double const*, double*, double*, double*)", referenced from: _main in wrf2sl.cc.o "typeinfo for MethodModel", referenced from: typeinfo for HeunEuler1 in wrf2sl.cc.o typeinfo for HeunEuler2 in wrf2sl.cc.o typeinfo for DormandPrince in wrf2sl.cc.o typeinfo for BogackiShampine in wrf2sl.cc.o typeinfo for RK41 in wrf2sl.cc.o "vtable for MethodModel", referenced from: MethodModel::MethodModel() in wrf2sl.cc.o MethodModel::~MethodModel() in wrf2sl.cc.o NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "vtable for rODE", referenced from: rODE::rODE(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, float) in wrf2sl.cc.o NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "vtable for Method", referenced from: Method::Method(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, float) in wrf2sl.cc.o NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "vtable for Solver", referenced from: Solver::Solver(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, float) in wrf2sl.cc.o NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "vtable for sfm::StreamlineWrf", referenced from: sfm::StreamlineWrf::StreamlineWrf(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, float) in wrf2sl.cc.o NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [expt/wrf2sl] Error 1 make[1]: *** [expt/CMakeFiles/wrf2sl.dir/all] Error 2 make: *** [all] Error 2 Do you know what is going on?