kzampog / cilantro

A lean C++ library for working with point cloud data
MIT License
1.01k stars 206 forks source link

complie smooth in ubuntu18.04,but not in win10 with VS2017 #56

Closed CarlLyt closed 3 years ago

CarlLyt commented 3 years ago

hi, Sorry to interrupt your life This is a amazing project, i use and complies smooth in ubuntu18.04, but now i need complies this project in win10, so there is so many trouble when i use cmake and VS2017 complie, I have complied Eigen3 and Panolin in my computer successfully, and cilantro project succeeded in finding Eigen3 and Panolin like image But it still compiles with various errors ,so I add `

find_package(Pangolin QUIET)

if(Pangolin_FOUND)

set(HAVE_PANGOLIN ON)

set(HAVE_PANGOLIN OFF)

set(DEPENDS_Pangolin "find_dependency(Pangolin)")

endif()

` I successfully compiled cilantro . but can't use in my project, the wrong message like:

Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol "public: cdecl tinyply::PlyFile::PlyFile(void)" (??0PlyFile@tinyply@@QEAA@XZ) referenced in function "public: cdecl cilantro::PLYReader::PLYReader(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,bool)" (??0PLYReader@cilantro@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N@Z) FaceScanViewerApp E:\FaceScan\FaceScanViwer\FaceScanViewerApp\facealign.obj 1

Error LNK2019 unresolved external symbol "public: cdecl tinyply::PlyFile::~PlyFile(void)" (??1PlyFile@tinyply@@QEAA@XZ) referenced in function "int `public: cdecl cilantro::PLYReader::PLYReader(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,bool)'::`1'::dtor$2" (?dtor$2@?0???0PLYReader@cilantro@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N@Z@4HA) FaceScanViewerApp E:\FaceScan\FaceScanViwer\FaceScanViewerApp\facealign.obj 1

Error LNK2019 unresolved external symbol "public: bool __cdecl tinyply::PlyFile::parse_header(class std::basic_istream<char,struct std::char_traits > &)" (?parse_header@PlyFile@tinyply@@QEAA_NAEAV?$basic_istream@DU?$char_traits@D@std@@@std@@@Z) referenced in function "public: __cdecl cilantro::PLYReader::PLYReader(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,bool)" (??0PLYReader@cilantro@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N@Z) FaceScanViewerApp E:\FaceScan\FaceScanViwer\FaceScanViewerApp\facealign.obj 1

Error LNK2019 unresolved external symbol "public: void cdecl tinyply::PlyFile::read(class std::basic_istream<char,struct std::char_traits > &)" (?read@PlyFile@tinyply@@QEAAXAEAV?$basic_istream@DU?$char_traits@D@std@@@std@@@Z) referenced in function "public: void cdecl cilantro::PLYReader::readData(void)" (?readData@PLYReader@cilantro@@QEAAXXZ) FaceScanViewerApp E:\FaceScan\FaceScanViwer\FaceScanViewerApp\facealign.obj 1

Error LNK2019 unresolved external symbol "public: class std::vector<struct tinyply::PlyElement,class std::allocator > cdecl tinyply::PlyFile::get_elements(void)const " (?get_elements@PlyFile@tinyply@@QEBA?AV?$vector@UPlyElement@tinyply@@V?$allocator@UPlyElement@tinyply@@@std@@@std@@XZ) referenced in function "public: bool cdecl cilantro::PLYReader::elementPropertyExists(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::vector<class std::basic_string<char,struct std::char_traits,class std::allocator >,class std::allocator<class std::basic_string<char,struct std::char_traits,class std::allocator > > > const &)const " (?elementPropertyExists@PLYReader@cilantro@@QEBA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@4@@Z) FaceScanViewerApp E:\FaceScan\FaceScanViwer\FaceScanViewerApp\facealign.obj 1

Error LNK2019 unresolved external symbol "public: class std::shared_ptr cdecl tinyply::PlyFile::request_properties_from_element(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::vector<class std::basic_string<char,struct std::char_traits,class std::allocator >,class std::allocator<class std::basic_string<char,struct std::char_traits,class std::allocator > > >,unsigned int)" (?request_properties_from_element@PlyFile@tinyply@@QEAA?AV?$shared_ptr@UPlyData@tinyply@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@V?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@4@I@Z) referenced in function "public: class std::shared_ptr cdecl cilantro::PLYReader::requestData(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class std::vector<class std::basic_string<char,struct std::char_traits,class std::allocator >,class std::allocator<class std::basic_string<char,struct std::char_traits,class std::allocator > > > const &,unsigned int)" (?requestData@PLYReader@cilantro@@QEAA?AV?$shared_ptr@UPlyData@tinyply@@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@4@AEBV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@4@I@Z) FaceScanViewerApp E:\FaceScan\FaceScanViwer\FaceScanViewerApp\facealign.obj 1

I know if i sucecss complie Eigen3 and Panolin in ubuntu18, cilantro also complie smoothly, but there is not in Win10. why?

kzampog commented 3 years ago

Hi! Unfortunately, I haven't given VS a proper try in a very long time :( One reason is that VS only supports a very old version of OpenMP, so some (if not all) of the multi-threading will not work (and may even fail to compile).

The error you're quoting seems to be at the linking stage and you mention that you were able to build the library. Are you linking your project against the library (e.g. using something like target_link_libraries(my_executable ${cilantro_LIBRARIES})?

BTW, did you manage to build the examples?

Not sure if it helps, but you should have no issues building everything within WSL on Windows :) (you might need an X server for the visualization stuff though).

Edit: this might also be interesting if you don't mind switching compilers: https://stackoverflow.com/questions/43318137/using-openmp-3-4-in-visual-studio-2017

CarlLyt commented 3 years ago

Thank you very much for your reply,
After an afternoon of hard work, I fixed this promble,I just tested the project , it worked well . I made the following adjustments

  1. OPenMP 2.0 seem not to be able use size_t in the for loop, so i replaced size_t with int.
  2. It look some promblem when i use the visualization stuff, so i add #find_package(Pangolin QUIET), Display functionality is not used
  3. I git clone tinyply in my computer, (cmake && make),and add the tinyply.lib in my own project

So, it work well without display function, that also satisfy my need Thank you again for taking the time to reply to my question, this issuse can be close :)