Open kozuch opened 7 years ago
Looks like I got rid of the C++98 error with a hint of #cmake FreeNode IRC user who said there are CMAKE_ prefixes missing here: set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON)
It still wont compile though but I am getting a bunch of different errors now (related to boost):
make Scanning dependencies of target SfMToyLibrary [ 14%] Building CXX object SfMToyLib/CMakeFiles/SfMToyLibrary.dir/SfMCommon.cpp.o [ 28%] Building CXX object SfMToyLib/CMakeFiles/SfMToyLibrary.dir/SfM.cpp.o /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp: In member function ‘bool sfmtoylib::SfM::setImagesDirectory(const string&)’: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: error: no matching function for call to ‘begin(boost::filesystem::directory_iterator&)’ for (directory_entry& x : directory_iterator(dirPath)) { ^ /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: note: candidates are: In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/random:41, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/local/include/opencv2/core/base.hpp:55, from /usr/local/include/opencv2/core.hpp:54, from /usr/local/include/opencv2/core/core.hpp:48, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfMCommon.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:28: /usr/include/c++/4.8/bits/range_access.h:87:5: note: template<class _Tp, long unsigned int _Nm> _Tp std::begin(_Tp (&)[_Nm]) begin(_Tp (&arr)[_Nm]) ^ /usr/include/c++/4.8/bits/range_access.h:87:5: note: template argument deduction/substitution failed: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: note: mismatched types ‘_Tp [_Nm]’ and ‘boost::filesystem::directory_iterator’ for (directory_entry& x : directory_iterator(dirPath)) { ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/random:41, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/local/include/opencv2/core/base.hpp:55, from /usr/local/include/opencv2/core.hpp:54, from /usr/local/include/opencv2/core/core.hpp:48, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfMCommon.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:28: /usr/include/c++/4.8/bits/range_access.h:58:5: note: template
decltype ( cont.begin()) std::begin(const _Container&) begin(const _Container& cont) -> decltype(cont.begin()) ^ /usr/include/c++/4.8/bits/range_access.h:58:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of ‘templatedecltype (cont.begin()) std::begin(const _Container&) [with _Container = boost::filesystem::directory_iterator]’: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: required from here /usr/include/c++/4.8/bits/range_access.h:58:5: error: ‘const class boost::filesystem::directory_iterator’ has no member named ‘begin’ /usr/include/c++/4.8/bits/range_access.h:48:5: note: template std::begin(std::initializer_list<_Tp>) begin(initializer_list<_Tp> ils) noexcept ^ /usr/include/c++/4.8/initializer_list:89:5: note: template argument deduction/substitution failed: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: note: ‘boost::filesystem::directory_iterator’ is not derived from ‘std::initializer_list<_Tp>’ for (directory_entry& x : directory_iterator(dirPath)) { ^ /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: error: no matching function for call to ‘end(boost::filesystem::directory_iterator&)’ /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: note: candidates are: In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/random:41, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/local/include/opencv2/core/base.hpp:55, from /usr/local/include/opencv2/core.hpp:54, from /usr/local/include/opencv2/core/core.hpp:48, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfMCommon.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:28: /usr/include/c++/4.8/bits/range_access.h:97:5: note: template<class _Tp, long unsigned int _Nm> _Tp* std::end(_Tp (&)[_Nm]) end(_Tp (&arr)[_Nm]) ^ /usr/include/c++/4.8/bits/range_access.h:97:5: note: template argument deduction/substitution failed: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: note: mismatched types ‘_Tp [_Nm]’ and ‘boost::filesystem::directory_iterator’ for (directory_entry& x : directory_iterator(dirPath)) { ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/random:41, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/local/include/opencv2/core/base.hpp:55, from /usr/local/include/opencv2/core.hpp:54, from /usr/local/include/opencv2/core/core.hpp:48, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfMCommon.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:28: /usr/include/c++/4.8/bits/range_access.h:78:5: note: templatedecltype (cont.begin()) std::begin(_Container&) begin(_Container& cont) -> decltype(__cont.begin()) ^ /usr/include/c++/4.8/bits/range_access.h:48:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of ‘template cont.begin()) std::begin(_Container&) [with _Container = boost::filesystem::directory_iterator]’: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: required from here /usr/include/c++/4.8/bits/range_access.h:48:5: error: ‘class boost::filesystem::directory_iterator’ has no member named ‘begin’ In file included from /usr/include/c++/4.8/utility:74:0, from /usr/include/c++/4.8/algorithm:60, from /usr/local/include/opencv2/core/base.hpp:55, from /usr/local/include/opencv2/core.hpp:54, from /usr/local/include/opencv2/core/core.hpp:48, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfMCommon.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:28: /usr/include/c++/4.8/initializer_list:89:5: note: templatedecltype ( constexpr const _Tp decltype ( cont.end()) std::end(const _Container&) end(const _Container& cont) -> decltype(cont.end()) ^ /usr/include/c++/4.8/bits/range_access.h:78:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of ‘templatedecltype ( cont.end()) std::end(const _Container&) [with _Container = boost::filesystem::directory_iterator]’: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: required from here /usr/include/c++/4.8/bits/range_access.h:78:5: error: ‘const class boost::filesystem::directory_iterator’ has no member named ‘end’ /usr/include/c++/4.8/bits/range_access.h:68:5: note: templatedecltype (cont.end()) std::end(_Container&) end(_Container& cont) -> decltype(__cont.end()) ^ /usr/include/c++/4.8/bits/range_access.h:68:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of ‘template decltype (cont.end()) std::end(_Container&) [with _Container = boost::filesystem::directory_iterator]’: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: required from here /usr/include/c++/4.8/bits/range_access.h:68:5: error: ‘class boost::filesystem::directory_iterator’ has no member named ‘end’ In file included from /usr/include/c++/4.8/utility:74:0, from /usr/include/c++/4.8/algorithm:60, from /usr/local/include/opencv2/core/base.hpp:55, from /usr/local/include/opencv2/core.hpp:54, from /usr/local/include/opencv2/core/core.hpp:48, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfMCommon.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:28: /usr/include/c++/4.8/initializer_list:99:5: note: template constexpr const _Tp* std::end(std::initializer_list<_Tp>) end(initializer_list<_Tp> ils) noexcept ^ /usr/include/c++/4.8/initializer_list:99:5: note: template argument deduction/substitution failed: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: note: ‘boost::filesystem::directory_iterator’ is not derived from ‘std::initializer_list<_Tp>’ for (directory_entry& x : directory_iterator(dirPath)) { ^ /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp: In member function ‘void sfmtoylib::SfM::saveCloudAndCamerasToPLY(const string&)’: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:636:18: error: variable ‘std::ofstream ofs’ has initializer but incomplete type ofstream ofs(prefix + "_points.ply"); ^ /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:668:19: error: variable ‘std::ofstream ofsc’ has initializer but incomplete type ofstream ofsc(prefix + "_cameras.ply"); ^ make[2]: [SfMToyLib/CMakeFiles/SfMToyLibrary.dir/SfM.cpp.o] Error 1 make[1]: [SfMToyLib/CMakeFiles/SfMToyLibrary.dir/all] Error 2 make: *** [all] Error 2
Thanks Jan, Please submit a PR when you're done fixing, so others can enjoy your findings.
On Jul 6, 2017, at 10:37 AM, Jan Kucera notifications@github.com wrote:
Looks like I got rid of the C++98 error with a hint of #cmake FreeNode IRC user who said there are CMAKE_ prefixes missing here: set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON)
It still wont compile though but I am getting a bunch of different errors now (related to boost):
make Scanning dependencies of target SfMToyLibrary [ 14%] Building CXX object SfMToyLib/CMakeFiles/SfMToyLibrary.dir/SfMCommon.cpp.o [ 28%] Building CXX object SfMToyLib/CMakeFiles/SfMToyLibrary.dir/SfM.cpp.o /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp: In member function ‘bool sfmtoylib::SfM::setImagesDirectory(const string&)’: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: error: no matching function for call to ‘begin(boost::filesystem::directory_iterator&)’ for (directory_entry& x : directory_iterator(dirPath)) { ^ /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: note: candidates are: In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/random:41, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/local/include/opencv2/core/base.hpp:55, from /usr/local/include/opencv2/core.hpp:54, from /usr/local/include/opencv2/core/core.hpp:48, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfMCommon.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:28: /usr/include/c++/4.8/bits/range_access.h:87:5: note: template<class _Tp, long unsigned int _Nm> _Tp std::begin(_Tp (&)[_Nm]) begin(_Tp (&__arr)[_Nm]) ^ /usr/include/c++/4.8/bits/range_access.h:87:5: note: template argument deduction/substitution failed: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: note: mismatched types ‘_Tp [_Nm]’ and ‘boost::filesystem::directory_iterator’ for (directory_entry& x : directory_iterator(dirPath)) { ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/random:41, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/local/include/opencv2/core/base.hpp:55, from /usr/local/include/opencv2/core.hpp:54, from /usr/local/include/opencv2/core/core.hpp:48, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfMCommon.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:28: /usr/include/c++/4.8/bits/range_access.h:58:5: note: template decltype (cont.begin()) std::begin(const _Container&) begin(const _Container& cont) -> decltype(cont.begin()) ^ /usr/include/c++/4.8/bits/range_access.h:58:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of ‘template decltype (cont.begin()) std::begin(const _Container&) [with _Container = boost::filesystem::directory_iterator]’: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: required from here /usr/include/c++/4.8/bits/range_access.h:58:5: error: ‘const class boost::filesystem::directory_iterator’ has no member named ‘begin’ /usr/include/c++/4.8/bits/range_access.h:48:5: note: template decltype (cont.begin()) std::begin(_Container&) begin(_Container& cont) -> decltype(cont.begin()) ^ /usr/include/c++/4.8/bits/range_access.h:48:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of ‘template decltype (cont.begin()) std::begin(_Container&) [with _Container = boost::filesystem::directory_iterator]’: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: required from here /usr/include/c++/4.8/bits/range_access.h:48:5: error: ‘class boost::filesystem::directory_iterator’ has no member named ‘begin’ In file included from /usr/include/c++/4.8/utility:74:0, from /usr/include/c++/4.8/algorithm:60, from /usr/local/include/opencv2/core/base.hpp:55, from /usr/local/include/opencv2/core.hpp:54, from /usr/local/include/opencv2/core/core.hpp:48, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfMCommon.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:28: /usr/include/c++/4.8/initializer_list:89:5: note: template constexpr const _Tp std::begin(std::initializer_list<_Tp>) begin(initializer_list<_Tp> ils) noexcept ^ /usr/include/c++/4.8/initializer_list:89:5: note: template argument deduction/substitution failed: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: note: ‘boost::filesystem::directory_iterator’ is not derived from ‘std::initializer_list<_Tp>’ for (directory_entry& x : directory_iterator(dirPath)) { ^ /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: error: no matching function for call to ‘end(boost::filesystem::directory_iterator&)’ /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: note: candidates are: In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/random:41, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/local/include/opencv2/core/base.hpp:55, from /usr/local/include/opencv2/core.hpp:54, from /usr/local/include/opencv2/core/core.hpp:48, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfMCommon.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:28: /usr/include/c++/4.8/bits/range_access.h:97:5: note: template<class _Tp, long unsigned int _Nm> _Tp* std::end(_Tp (&)[_Nm]) end(_Tp (&__arr)[_Nm]) ^ /usr/include/c++/4.8/bits/range_access.h:97:5: note: template argument deduction/substitution failed: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: note: mismatched types ‘_Tp [_Nm]’ and ‘boost::filesystem::directory_iterator’ for (directory_entry& x : directory_iterator(dirPath)) { ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/random:41, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/local/include/opencv2/core/base.hpp:55, from /usr/local/include/opencv2/core.hpp:54, from /usr/local/include/opencv2/core/core.hpp:48, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfMCommon.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:28: /usr/include/c++/4.8/bits/range_access.h:78:5: note: template decltype (cont.end()) std::end(const _Container&) end(const _Container& cont) -> decltype(cont.end()) ^ /usr/include/c++/4.8/bits/range_access.h:78:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of ‘template decltype (cont.end()) std::end(const _Container&) [with _Container = boost::filesystem::directory_iterator]’: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: required from here /usr/include/c++/4.8/bits/range_access.h:78:5: error: ‘const class boost::filesystem::directory_iterator’ has no member named ‘end’ /usr/include/c++/4.8/bits/range_access.h:68:5: note: template decltype (cont.end()) std::end(_Container&) end(_Container& cont) -> decltype(cont.end()) ^ /usr/include/c++/4.8/bits/range_access.h:68:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of ‘template decltype (__cont.end()) std::end(_Container&) [with _Container = boost::filesystem::directory_iterator]’: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: required from here /usr/include/c++/4.8/bits/range_access.h:68:5: error: ‘class boost::filesystem::directory_iterator’ has no member named ‘end’ In file included from /usr/include/c++/4.8/utility:74:0, from /usr/include/c++/4.8/algorithm:60, from /usr/local/include/opencv2/core/base.hpp:55, from /usr/local/include/opencv2/core.hpp:54, from /usr/local/include/opencv2/core/core.hpp:48, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfMCommon.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.h:31, from /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:28: /usr/include/c++/4.8/initializer_list:99:5: note: template constexpr const _Tp* std::end(std::initializer_list<_Tp>) end(initializer_list<_Tp> __ils) noexcept ^ /usr/include/c++/4.8/initializer_list:99:5: note: template argument deduction/substitution failed: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:107:57: note: ‘boost::filesystem::directory_iterator’ is not derived from ‘std::initializer_list<_Tp>’ for (directory_entry& x : directory_iterator(dirPath)) { ^ /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp: In member function ‘void sfmtoylib::SfM::saveCloudAndCamerasToPLY(const string&)’: /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:636:18: error: variable ‘std::ofstream ofs’ has initializer but incomplete type ofstream ofs(prefix + "_points.ply"); ^ /home/kozuch/smf/SfM-Toy-Library-master/SfMToyLib/SfM.cpp:668:19: error: variable ‘std::ofstream ofsc’ has initializer but incomplete type ofstream ofsc(prefix + "_cameras.ply"); ^ make[2]: [SfMToyLib/CMakeFiles/SfMToyLibrary.dir/SfM.cpp.o] Error 1 make[1]: [SfMToyLib/CMakeFiles/SfMToyLibrary.dir/all] Error 2 make: *** [all] Error 2
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
I got another hint on IRC to update boost library from 1.54 to newer. Issues #35 and #37 seem to deal with this solving it with boost update to 1.62 and 1.63.
@royshil
I created a PR for the missing CMAKE_ preffixes: https://github.com/royshil/SfM-Toy-Library/pull/41
However I do not know what minimum version of boost you need so you maybe want to add that yourself? The issues I linked above tested 1.62 to be working. I have not tested my upgraded boost yet.
I am trying to get the library working on Ubuntu 14.04. I upgraded my cmake from 2.8 to 3.2.2 (installed via PPA according to this post - https://askubuntu.com/a/610352/133573) but the library will not compile. For make i get this error:
I even tried to inject lines for C++11 support from the main CMakeLists.txt to SfMToyLib/CMakeLists.txt but that did not help (inserted just after cmake version check)): set(CXX_STANDARD 11) set(CXX_STANDARD_REQUIRED ON)
This is my cmake output:
Can someone help me please?