LINUX.ORG.RU

cmake. ошибки во время сборки

 


0

1

Здравствуйте. Пытаюсь установить проект. Во время сборки проекта возникают такие ошибки. Как это устранить? Спасибо за ответы.

sergey@sergey:/opt/SfM-Toy-Library/build$ sudo cmake ..
[sudo] пароль для sergey: 
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   system
--   chrono
--   filesystem
--   unit_test_framework
--   program_options
-- Found required Ceres dependency: Eigen version 3.3.2 in /usr/local/include/eigen3
-- Found required Ceres dependency: glog
-- Found required Ceres dependency: gflags
-- Found Ceres version: 1.12.0 installed in: /usr/local with components: [LAPACK, SuiteSparse, SparseLinearAlgebraLibrary, SchurSpecializations, OpenMP]
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/SfM-Toy-Library/build
sergey@sergey:/opt/SfM-Toy-Library/build$ sudo make
Scanning dependencies of target SfMToyLibrary
[ 10%] Building CXX object SfMToyLib/CMakeFiles/SfMToyLibrary.dir/SfMCommon.cpp.o
In file included from /opt/SfM-Toy-Library/SfMToyLib/SfMCommon.cpp:28:0:
/opt/SfM-Toy-Library/SfMToyLib/SfMCommon.h:211:5: error: in C++98 ‘sfmtoylib::Colors::WHEEL’ must be initialized by constructor, not by ‘{...}’
     };
     ^
/opt/SfM-Toy-Library/SfMToyLib/SfMCommon.h:211:5: error: could not convert ‘{sfmtoylib::Colors::BLUE, sfmtoylib::Colors::AQUA, sfmtoylib::Colors::CYAN, sfmtoylib::Colors::MARINE, sfmtoylib::Colors::GREEN, sfmtoylib::Colors::LIME, sfmtoylib::Colors::YELLOW, sfmtoylib::Colors::ORANGE, sfmtoylib::Colors::RED, sfmtoylib::Colors::BEIGE, sfmtoylib::Colors::PURPLE, sfmtoylib::Colors::DEEP, sfmtoylib::Colors::BLACK}’ from ‘<brace-enclosed initializer list>’ to ‘const std::vector<cv::Scalar_<double> >’
/opt/SfM-Toy-Library/SfMToyLib/SfMCommon.cpp: In function ‘void sfmtoylib::KeyPointsToPoints(const Keypoints&, sfmtoylib::Points2f&)’:
/opt/SfM-Toy-Library/SfMToyLib/SfMCommon.cpp:91:22: error: ISO C++ forbids declaration of ‘kp’ with no type [-fpermissive]
     for (const auto& kp : kps) {
                      ^
/opt/SfM-Toy-Library/SfMToyLib/SfMCommon.cpp:91:27: warning: range-based ‘for’ loops only available with -std=c++11 or -std=gnu++11
     for (const auto& kp : kps) {
                           ^
/opt/SfM-Toy-Library/SfMToyLib/SfMCommon.cpp:92:25: error: request for member ‘pt’ in ‘kp’, which is of non-class type ‘const int’
         ps.push_back(kp.pt);
                         ^
/opt/SfM-Toy-Library/SfMToyLib/SfMCommon.cpp: In function ‘void sfmtoylib::PointsToKeyPoints(const Points2f&, sfmtoylib::Keypoints&)’:
/opt/SfM-Toy-Library/SfMToyLib/SfMCommon.cpp:104:22: error: ISO C++ forbids declaration of ‘p’ with no type [-fpermissive]
     for (const auto& p : ps) {
                      ^
/opt/SfM-Toy-Library/SfMToyLib/SfMCommon.cpp:104:26: warning: range-based ‘for’ loops only available with -std=c++11 or -std=gnu++11
     for (const auto& p : ps) {
                          ^
/opt/SfM-Toy-Library/SfMToyLib/SfMCommon.cpp:105:39: error: no matching function for call to ‘cv::KeyPoint::KeyPoint(const int&, float)’
         kps.push_back(KeyPoint(p, 1.0f));
                                       ^
In file included from /usr/local/include/opencv2/core.hpp:58:0,
                 from /usr/local/include/opencv2/core/core.hpp:48,
                 from /opt/SfM-Toy-Library/SfMToyLib/SfMCommon.h:31,
                 from /opt/SfM-Toy-Library/SfMToyLib/SfMCommon.cpp:28:
/usr/local/include/opencv2/core/types.hpp:2229:1: note: candidate: cv::KeyPoint::KeyPoint(float, float, float, float, float, int, int)
 KeyPoint::KeyPoint(float x, float y, float _size, float _angle, float _response
 ^
/usr/local/include/opencv2/core/types.hpp:2229:1: note:   candidate expects 7 arguments, 2 provided
/usr/local/include/opencv2/core/types.hpp:2225:1: note: candidate: cv::KeyPoint::KeyPoint(cv::Point2f, float, float, float, int, int)
 KeyPoint::KeyPoint(Point2f _pt, float _size, float _angle, float _response, int
 ^
/usr/local/include/opencv2/core/types.hpp:2225:1: note:   no known conversion for argument 1 from ‘const int’ to ‘cv::Point2f {aka cv::Point_<float>}’
/usr/local/include/opencv2/core/types.hpp:2221:1: note: candidate: cv::KeyPoint::KeyPoint()
 KeyPoint::KeyPoint()
 ^
/usr/local/include/opencv2/core/types.hpp:2221:1: note:   candidate expects 0 arguments, 2 provided
/usr/local/include/opencv2/core/types.hpp:641:27: note: candidate: cv::KeyPoint::KeyPoint(const cv::KeyPoint&)
 class CV_EXPORTS_W_SIMPLE KeyPoint
                           ^
/usr/local/include/opencv2/core/types.hpp:641:27: note:   candidate expects 1 argument, 2 provided
SfMToyLib/CMakeFiles/SfMToyLibrary.dir/build.make:62: ошибка выполнения рецепта для цели «SfMToyLib/CMakeFiles/SfMToyLibrary.dir/SfMCommon.cpp.o»
make[2]: *** [SfMToyLib/CMakeFiles/SfMToyLibrary.dir/SfMCommon.cpp.o] Ошибка 1
CMakeFiles/Makefile2:161: ошибка выполнения рецепта для цели «SfMToyLib/CMakeFiles/SfMToyLibrary.dir/all»
make[1]: *** [SfMToyLib/CMakeFiles/SfMToyLibrary.dir/all] Ошибка 2
Makefile:83: ошибка выполнения рецепта для цели «all»
make: *** [all] Ошибка 2

и судя по всему у тебя конпелятор запустился без поддержки 11 плюсов...ну или 14

error: in C++98

anonymous
()
/opt/SfM-Toy-Library/SfMToyLib/SfMCommon.cpp:91:27: warning: range-based ‘for’ loops only available with -std=c++11

очевидно что в опциях компилятора нужен этот флаг. Открой CMakeLists.txt и пропиши там

set(CMAKE_CXX_STANDARD 11)

anonymous
()
Ответ на: комментарий от anonymous

можна просто cmake -DCMAKE_CXX_STANDARD=11 ..

anonymous
()

После включения опции -DCMAKE_CXX_STANDARD=11 останавливатся на следующем месте что тут ему не нравится?

[ 10%] Building CXX object SfMToyLib/CMakeFiles/SfMToyLibrary.dir/SfMCommon.cpp.o
[ 20%] Building CXX object SfMToyLib/CMakeFiles/SfMToyLibrary.dir/SfM.cpp.o
/opt/SfM-Toy-Library/SfMToyLib/SfM.cpp: In member function ‘void sfmtoylib::SfM::saveCloudAndCamerasToPLY(const string&)’:
/opt/SfM-Toy-Library/SfMToyLib/SfM.cpp:636:18: error: variable ‘std::ofstream ofs’ has initializer but incomplete type
     ofstream ofs(prefix + "_points.ply");
                  ^
/opt/SfM-Toy-Library/SfMToyLib/SfM.cpp:668:19: error: variable ‘std::ofstream ofsc’ has initializer but incomplete type
     ofstream ofsc(prefix + "_cameras.ply");
                   ^
SfMToyLib/CMakeFiles/SfMToyLibrary.dir/build.make:86: ошибка выполнения рецепта для цели «SfMToyLib/CMakeFiles/SfMToyLibrary.dir/SfM.cpp.o»
make[2]: *** [SfMToyLib/CMakeFiles/SfMToyLibrary.dir/SfM.cpp.o] Ошибка 1
CMakeFiles/Makefile2:161: ошибка выполнения рецепта для цели «SfMToyLib/CMakeFiles/SfMToyLibrary.dir/all»
make[1]: *** [SfMToyLib/CMakeFiles/SfMToyLibrary.dir/all] Ошибка 2
Makefile:83: ошибка выполнения рецепта для цели «all»
make: *** [all] Ошибка 2

mult1plexer
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.