Closed Gaoqinghong91 closed 4 years ago
@Gaoqinghong91,
make install
from the terminal if you're working in Linux or MacOS (or by building the "INSTALL" project if you're working in Windows with MSVC, but it looks like you're not).find_package
command apriori) :
target_link_libraries(your_project_name_in_CMake PUBLIC cilantro)
Reference: https://cmake.org/cmake/help/latest/command/target_link_libraries.html
@Algomorph ,Thank you so much for your reply and advice. my system is ubuntu 16.04 and I have installed.
Are there any examples about how to write CMakeLists?
cmake_minimum_required (VERSION 2.8)
project (point)
set(CMAKE_CXX_STANDARD 11)
find_package(cilantro REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(Pangolin REQUIRED)
add_executable(gen non_rigid_icp.cpp ) target_link_libraries(gen ${cilantro_LIBS} ${Pangolin_LIBRARIES} )
2.the 'non_rigid_icp.cpp' is copied from the examples of cilantro.
Hi,
Apologies for the delayed response :)
I think you have to change ${cilantro_LIBS}
to ${cilantro_LIBRARIES}
in your CMakeLists
-- other than that, it should work. You most likely don't have to explicitly link against Eigen and Pangolin (the cilantro config should take care of that).
Cheers!
thank you for your reply, i have solved this problem.
Hi! I faced the same problem. Could you please give some details about your solutions? Thank you very much!
are there any examples about how to write CMakeLists. and how to this library in my project when i write a CMakeLists and make the "non_rigid_icp.cpp" , but i get mistake like:
[ 50%] Building CXX object CMakeFiles/gen.dir/non_rigid_icp.cpp.o [100%] Linking CXX executable gen CMakeFiles/gen.dir/non_rigid_icp.cpp.o: In function, std::allocator > const&) const'
non_rigid_icp.cpp:(.text+0x1a5): undefined reference to cxx11::basic_string<char, std::char_traits, std::allocator > const&, cilantro::RenderingProperties const&)'
non_rigid_icp.cpp:(.text+0x295): undefined reference to , std::allocator > const&, cilantro::RenderingProperties const&)'
CMakeFiles/gen.dir/non_rigid_icp.cpp.o: In function , std::allocator > const&)'
CMakeFiles/gen.dir/non_rigid_icp.cpp.o: In function cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::cxx11::basic_string<char, std::char_traits, std::allocator > const&)'
non_rigid_icp.cpp:(.text+0xf6f): undefined reference to `cilantro::Visualizer::Visualizer(std:: cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::cxx11::basic_string<char, std::char_traits, std::allocator > const&)'
non_rigid_icp.cpp:(.text+0xfd7): undefined reference to `cilantro::Visualizer::Visualizer(std:: cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::cxx11::basic_string<char, std::char_traits, std::allocator > const&)'
non_rigid_icp.cpp:(.text+0x10c2): undefined reference to cxx11::basic_string<char, std::char_traits, std::allocator > const&, bool)':
non_rigid_icp.cpp:(.text._ZN8cilantro9PLYReaderC2ERKNSt7 cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb[_ZN8cilantro9PLYReaderC5ERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb]+0x42): undefined reference to `tinyply::PlyFile::PlyFile()'
non_rigid_icp.cpp:(.text._ZN8cilantro9PLYReaderC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb[_ZN8cilantro9PLYReaderC5ERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb]+0x103): undefined reference to , std::allocator > const&, std::vector<std:: cxx11::basic_string<char, std::char_traits, std::allocator >, std::allocator<std::__cxx11::basic_string<char, std::char_traits, std::allocator > > >, unsigned int)'
CMakeFiles/gen.dir/non_rigid_icp.cpp.o: In function
color_toggle(cilantro::Visualizer&)': non_rigid_icp.cpp:(.text+0x17a): undefined reference to
cilantro::Visualizer::getRenderingProperties(std::cxx11::basic_string<char, std::char_traitscilantro::RenderingProperties::noColor' non_rigid_icp.cpp:(.text+0x1de): undefined reference to
cilantro::RenderingProperties::noColor' non_rigid_icp.cpp:(.text+0x230): undefined reference to `cilantro::Visualizer::setRenderingProperties(std::cilantro::Visualizer::getRenderingProperties(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const' non_rigid_icp.cpp:(.text+0x2e5): undefined reference to
cilantro::RenderingProperties::noColor' non_rigid_icp.cpp:(.text+0x31e): undefined reference tocilantro::RenderingProperties::noColor' non_rigid_icp.cpp:(.text+0x370): undefined reference to
cilantro::Visualizer::setRenderingProperties(std::cxx11::basic_string<char, std::char_traitswarp_toggle(cilantro::Visualizer&)': non_rigid_icp.cpp:(.text+0x4e9): undefined reference to
cilantro::Visualizer::toggleVisibility(std::cxx11::basic_string<char, std::char_traitsmain': non_rigid_icp.cpp:(.text+0xf07): undefined reference to
cilantro::Visualizer::Visualizer(std::cilantro::Visualizer::registerKeyboardCallback(unsigned char, std::function<void ()>)' non_rigid_icp.cpp:(.text+0x1136): undefined reference to
cilantro::Visualizer::registerKeyboardCallback(unsigned char, std::function<void ()>)' non_rigid_icp.cpp:(.text+0x13e6): undefined reference tocilantro::Visualizer::registerKeyboardCallback(unsigned char, std::function<void ()>)' non_rigid_icp.cpp:(.text+0x171a): undefined reference to
cilantro::Visualizer::clearRenderArea()' non_rigid_icp.cpp:(.text+0x1729): undefined reference tocilantro::Visualizer::render()' non_rigid_icp.cpp:(.text+0x1738): undefined reference to
cilantro::Visualizer::render()' non_rigid_icp.cpp:(.text+0x1747): undefined reference tocilantro::Visualizer::render()' non_rigid_icp.cpp:(.text+0x1774): undefined reference to
cilantro::Visualizer::~Visualizer()' non_rigid_icp.cpp:(.text+0x1783): undefined reference tocilantro::Visualizer::~Visualizer()' non_rigid_icp.cpp:(.text+0x1792): undefined reference to
cilantro::Visualizer::~Visualizer()' non_rigid_icp.cpp:(.text+0x1c04): undefined reference tocilantro::Visualizer::~Visualizer()' non_rigid_icp.cpp:(.text+0x1c13): undefined reference to
cilantro::Visualizer::~Visualizer()' CMakeFiles/gen.dir/non_rigid_icp.cpp.o:non_rigid_icp.cpp:(.text+0x1c22): more undefined references tocilantro::Visualizer::~Visualizer()' follow CMakeFiles/gen.dir/non_rigid_icp.cpp.o: In function
cilantro::PLYReader::PLYReader(std::tinyply::PlyFile::parse_header(std::istream&)' non_rigid_icp.cpp:(.text._ZN8cilantro9PLYReaderC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb[_ZN8cilantro9PLYReaderC5ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb]+0x138): undefined reference to
tinyply::PlyFile::~PlyFile()' CMakeFiles/gen.dir/non_rigid_icp.cpp.o: In functioncilantro::PLYReader::elementPropertyExists(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) const': non_rigid_icp.cpp:(.text._ZNK8cilantro9PLYReader21elementPropertyExistsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS6_SaIS6_EE[_ZNK8cilantro9PLYReader21elementPropertyExistsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS6_SaIS6_EE]+0x46): undefined reference to
tinyply::PlyFile::get_elements() const' CMakeFiles/gen.dir/non_rigid_icp.cpp.o: In functioncilantro::PLYReader::requestData(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, unsigned int)': non_rigid_icp.cpp:(.text._ZN8cilantro9PLYReader11requestDataERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS6_SaIS6_EEj[_ZN8cilantro9PLYReader11requestDataERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS6_SaIS6_EEj]+0x89): undefined reference to
tinyply::PlyFile::request_properties_from_element(std::cxx11::basic_string<char, std::char_traitscilantro::PLYReader::readData()': non_rigid_icp.cpp:(.text._ZN8cilantro9PLYReader8readDataEv[_ZN8cilantro9PLYReader8readDataEv]+0x2e): undefined reference to
tinyply::PlyFile::read(std::istream&)' CMakeFiles/gen.dir/non_rigid_icp.cpp.o: In functioncilantro::RenderingProperties::RenderingProperties()': non_rigid_icp.cpp:(.text._ZN8cilantro19RenderingPropertiesC2Ev[_ZN8cilantro19RenderingPropertiesC5Ev]+0x30): undefined reference to
cilantro::RenderingProperties::noColor' non_rigid_icp.cpp:(.text._ZN8cilantro19RenderingPropertiesC2Ev[_ZN8cilantro19RenderingPropertiesC5Ev]+0x45): undefined reference tocilantro::RenderingProperties::noColor' CMakeFiles/gen.dir/non_rigid_icp.cpp.o: In function
cilantro::PLYReader::~PLYReader()': non_rigid_icp.cpp:(.text._ZN8cilantro9PLYReaderD2Ev[_ZN8cilantro9PLYReaderD5Ev]+0x18): undefined reference totinyply::PlyFile::~PlyFile()' CMakeFiles/gen.dir/non_rigid_icp.cpp.o: In function
cilantro::PointCloudRenderable::PointCloudRenderable<cilantro::PointCloud<float, 3l>, void>(cilantro::PointCloud<float, 3l> const&, cilantro::RenderingProperties const&)': non_rigid_icp.cpp:(.text._ZN8cilantro20PointCloudRenderableC2INS_10PointCloudIfLl3EEEvEERKT_RKNS_19RenderingPropertiesE[_ZN8cilantro20PointCloudRenderableC5INS_10PointCloudIfLl3EEEvEERKT_RKNS_19RenderingPropertiesE]+0x72): undefined reference tovtable for cilantro::PointCloudRenderable' CMakeFiles/gen.dir/non_rigid_icp.cpp.o: In function
cilantro::PointCorrespondencesRenderable::PointCorrespondencesRenderable<cilantro::PointCloud<float, 3l>, void>(cilantro::PointCloud<float, 3l> const&, cilantro::PointCloud<float, 3l> const&, cilantro::RenderingProperties const&)': non_rigid_icp.cpp:(.text._ZN8cilantro30PointCorrespondencesRenderableC2INS_10PointCloudIfLl3EEEvEERKT_S6_RKNS_19RenderingPropertiesE[_ZN8cilantro30PointCorrespondencesRenderableC5INS_10PointCloudIfLl3EEEvEERKT_S6_RKNS_19RenderingPropertiesE]+0x7f): undefined reference to `vtable for cilantro::PointCorrespondencesRenderable' collect2: error: ld returned 1 exit status CMakeFiles/gen.dir/build.make:131: recipe for target 'gen' failed make[2]: [gen] Error 1 CMakeFiles/Makefile2:95: recipe for target 'CMakeFiles/gen.dir/all' failed make[1]: [CMakeFiles/gen.dir/all] Error 2 Makefile:103: recipe for target 'all' failed make: *** [all] Error 2 thank you very much!!