我是一名C ++新手,试图编译一些OpenCV教程代码。
我正在运行Ubuntu 16.04,并使用此脚本安装了OpenCV 3.1.0:https://github.com/milq/scripts-ubuntu-debian/blob/master/install-opencv.sh
我尝试编译的源文件在这里: https://github.com/opencv/opencv/blob/master/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp
我写了这个makefile:
CC=g++
CFLAGS = `pkg-config --cflags opencv` -c -g
LIBS = `pkg-config --libs opencv`
all: camcalib
camcalib: camera_calibration.o
$(CC) camera_calibration.o -o camcalib
camera_calibration.o: camera_calibration.cpp
$(CC) $(CFLAGS) $(LIBS) camera_calibration.cpp
clean:
rm *o camcalib
当我" make"时,会生成camera_calibration.o目标文件,但在链接过程中出现以下错误:
make
g++ `pkg-config --cflags opencv` -c -g `pkg-config --libs opencv` camera_calibration.cpp
g++ camera_calibration.o -o camcalib
camera_calibration.o: In function `cv::read(cv::FileNode const&, bool&, bool)':
/usr/local/include/opencv2/core/persistence.hpp:996: undefined reference to `cv::read(cv::FileNode const&, int&, int)'
camera_calibration.o: In function `cv::operator<<(cv::FileStorage&, char const*)':
/usr/local/include/opencv2/core/persistence.hpp:1076: undefined reference to `cv::operator<<(cv::FileStorage&, cv::String const&)'
camera_calibration.o: In function `cv::operator<<(cv::FileStorage&, char*)':
/usr/local/include/opencv2/core/persistence.hpp:1084: undefined reference to `cv::operator<<(cv::FileStorage&, cv::String const&)'
camera_calibration.o: In function `void cv::operator>><std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(cv::FileNode const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
/usr/local/include/opencv2/core/cvstd.inl.hpp:155: undefined reference to `cv::read(cv::FileNode const&, cv::String&, cv::String const&)'
camera_calibration.o: In function `main':
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:239: undefined reference to `cv::FileStorage::FileStorage(cv::String const&, int, cv::String const&)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:240: undefined reference to `cv::FileStorage::isOpened() const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:245: undefined reference to `cv::FileStorage::operator[](char const*) const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:246: undefined reference to `cv::FileStorage::release()'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:292: undefined reference to `cv::flip(cv::_InputArray const&, cv::_OutputArray const&, int)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:309: undefined reference to `cv::findChessboardCorners(cv::_InputArray const&, cv::Size_<int>, cv::_OutputArray const&, int)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:312: undefined reference to `cv::SimpleBlobDetector::Params::Params()'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:312: undefined reference to `cv::SimpleBlobDetector::create(cv::SimpleBlobDetector::Params const&)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:312: undefined reference to `cv::findCirclesGrid(cv::_InputArray const&, cv::Size_<int>, cv::_OutputArray const&, int, cv::Ptr<cv::Feature2D> const&)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:315: undefined reference to `cv::SimpleBlobDetector::Params::Params()'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:315: undefined reference to `cv::SimpleBlobDetector::create(cv::SimpleBlobDetector::Params const&)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:315: undefined reference to `cv::findCirclesGrid(cv::_InputArray const&, cv::Size_<int>, cv::_OutputArray const&, int, cv::Ptr<cv::Feature2D> const&)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:329: undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:331: undefined reference to `cv::cornerSubPix(cv::_InputArray const&, cv::_InputOutputArray const&, cv::Size_<int>, cv::Size_<int>, cv::TermCriteria)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:335: undefined reference to `cv::VideoCapture::isOpened() const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:339: undefined reference to `cv::VideoCapture::isOpened() const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:343: undefined reference to `cv::drawChessboardCorners(cv::_InputOutputArray const&, cv::Size_<int>, cv::_InputArray const&, bool)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:351: undefined reference to `cv::getTextSize(cv::String const&, int, double, int, int*)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:357: undefined reference to `cv::format(char const*, ...)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:359: undefined reference to `cv::format(char const*, ...)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:362: undefined reference to `cv::putText(cv::_InputOutputArray const&, cv::String const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)'
camera_calibration.o: In function `main':
/usr/local/include/opencv2/core.hpp:1257: undefined reference to `cv::noArray()'
camera_calibration.o: In function `main':
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:365: undefined reference to `cv::bitwise_not(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&)'
camera_calibration.o: In function `main':
/usr/local/include/opencv2/imgproc.hpp:2609: undefined reference to `cv::noArray()'
camera_calibration.o: In function `main':
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:372: undefined reference to `cv::undistort(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:377: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:378: undefined reference to `cv::VideoCapture::isOpened() const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:378: undefined reference to `cv::waitKey(int)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:386: undefined reference to `cv::VideoCapture::isOpened() const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:404: undefined reference to `cv::fisheye::estimateNewCameraMatrixForUndistortRectify(cv::_InputArray const&, cv::_InputArray const&, cv::Size_<int> const&, cv::_InputArray const&, cv::_OutputArray const&, double, cv::Size_<int> const&, double)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:406: undefined reference to `cv::fisheye::initUndistortRectifyMap(cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::Size_<int> const&, int, cv::_OutputArray const&, cv::_OutputArray const&)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:412: undefined reference to `cv::getOptimalNewCameraMatrix(cv::_InputArray const&, cv::_InputArray const&, cv::Size_<int>, double, cv::Size_<int>, cv::Rect_<int>*, bool)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:413: undefined reference to `cv::initUndistortRectifyMap(cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::Size_<int>, int, cv::_OutputArray const&, cv::_OutputArray const&)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:418: undefined reference to `cv::imread(cv::String const&, int)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:421: undefined reference to `cv::remap(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::_InputArray const&, int, int, cv::Scalar_<double> const&)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:422: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:423: undefined reference to `cv::waitKey(int)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:239: undefined reference to `cv::FileStorage::~FileStorage()'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:431: undefined reference to `cv::FileStorage::~FileStorage()'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:431: undefined reference to `cv::FileStorage::~FileStorage()'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:239: undefined reference to `cv::FileStorage::~FileStorage()'
camera_calibration.o: In function `computeReprojectionErrors(std::vector<std::vector<cv::Point3_<float>, std::allocator<cv::Point3_<float> > >, std::allocator<std::vector<cv::Point3_<float>, std::allocator<cv::Point3_<float> > > > > const&, std::vector<std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > >, std::allocator<std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > > > > const&, std::vector<cv::Mat, std::allocator<cv::Mat> > const&, std::vector<cv::Mat, std::allocator<cv::Mat> > const&, cv::Mat const&, cv::Mat const&, std::vector<float, std::allocator<float> >&, bool)':
/usr/local/include/opencv2/calib3d.hpp:1795: undefined reference to `cv::noArray()'
camera_calibration.o: In function `computeReprojectionErrors(std::vector<std::vector<cv::Point3_<float>, std::allocator<cv::Point3_<float> > >, std::allocator<std::vector<cv::Point3_<float>, std::allocator<cv::Point3_<float> > > > > const&, std::vector<std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > >, std::allocator<std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > > > > const&, std::vector<cv::Mat, std::allocator<cv::Mat> > const&, std::vector<cv::Mat, std::allocator<cv::Mat> > const&, cv::Mat const&, cv::Mat const&, std::vector<float, std::allocator<float> >&, bool)':
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:450: undefined reference to `cv::fisheye::projectPoints(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, double, cv::_OutputArray const&)'
camera_calibration.o: In function `computeReprojectionErrors(std::vector<std::vector<cv::Point3_<float>, std::allocator<cv::Point3_<float> > >, std::allocator<std::vector<cv::Point3_<float>, std::allocator<cv::Point3_<float> > > > > const&, std::vector<std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > >, std::allocator<std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > > > > const&, std::vector<cv::Mat, std::allocator<cv::Mat> > const&, std::vector<cv::Mat, std::allocator<cv::Mat> > const&, cv::Mat const&, cv::Mat const&, std::vector<float, std::allocator<float> >&, bool)':
/usr/local/include/opencv2/calib3d.hpp:513: undefined reference to `cv::noArray()'
camera_calibration.o: In function `computeReprojectionErrors(std::vector<std::vector<cv::Point3_<float>, std::allocator<cv::Point3_<float> > >, std::allocator<std::vector<cv::Point3_<float>, std::allocator<cv::Point3_<float> > > > > const&, std::vector<std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > >, std::allocator<std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > > > > const&, std::vector<cv::Mat, std::allocator<cv::Mat> > const&, std::vector<cv::Mat, std::allocator<cv::Mat> > const&, cv::Mat const&, cv::Mat const&, std::vector<float, std::allocator<float> >&, bool)':
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:454: undefined reference to `cv::projectPoints(cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, double)'
camera_calibration.o: In function `computeReprojectionErrors(std::vector<std::vector<cv::Point3_<float>, std::allocator<cv::Point3_<float> > >, std::allocator<std::vector<cv::Point3_<float>, std::allocator<cv::Point3_<float> > > > > const&, std::vector<std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > >, std::allocator<std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > > > > const&, std::vector<cv::Mat, std::allocator<cv::Mat> > const&, std::vector<cv::Mat, std::allocator<cv::Mat> > const&, cv::Mat const&, cv::Mat const&, std::vector<float, std::allocator<float> >&, bool)':
/usr/local/include/opencv2/core.hpp:668: undefined reference to `cv::noArray()'
camera_calibration.o: In function `computeReprojectionErrors(std::vector<std::vector<cv::Point3_<float>, std::allocator<cv::Point3_<float> > >, std::allocator<std::vector<cv::Point3_<float>, std::allocator<cv::Point3_<float> > > > > const&, std::vector<std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > >, std::allocator<std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > > > > const&, std::vector<cv::Mat, std::allocator<cv::Mat> > const&, std::vector<cv::Mat, std::allocator<cv::Mat> > const&, cv::Mat const&, cv::Mat const&, std::vector<float, std::allocator<float> >&, bool)':
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:456: undefined reference to `cv::norm(cv::_InputArray const&, cv::_InputArray const&, int, cv::_InputArray const&)'
camera_calibration.o: In function `runCalibration(Settings&, cv::Size_<int>&, cv::Mat&, cv::Mat&, std::vector<std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > >, std::allocator<std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > > > >, std::vector<cv::Mat, std::allocator<cv::Mat> >&, std::vector<cv::Mat, std::allocator<cv::Mat> >&, std::vector<float, std::allocator<float> >&, double&)':
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:497: undefined reference to `cv::Mat::eye(int, int, int)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:502: undefined reference to `cv::Mat::zeros(int, int, int)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:504: undefined reference to `cv::Mat::zeros(int, int, int)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:518: undefined reference to `cv::fisheye::calibrate(cv::_InputArray const&, cv::_InputArray const&, cv::Size_<int> const&, cv::_InputOutputArray const&, cv::_InputOutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, int, cv::TermCriteria)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:528: undefined reference to `cv::calibrateCamera(cv::_InputArray const&, cv::_InputArray const&, cv::Size_<int>, cv::_InputOutputArray const&, cv::_InputOutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, int, cv::TermCriteria)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:533: undefined reference to `cv::checkRange(cv::_InputArray const&, bool, cv::Point_<int>*, double, double)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:533: undefined reference to `cv::checkRange(cv::_InputArray const&, bool, cv::Point_<int>*, double, double)'
camera_calibration.o: In function `saveCameraParams(Settings&, cv::Size_<int>&, cv::Mat&, cv::Mat&, std::vector<cv::Mat, std::allocator<cv::Mat> > const&, std::vector<cv::Mat, std::allocator<cv::Mat> > const&, std::vector<float, std::allocator<float> > const&, std::vector<std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > >, std::allocator<std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > > > > const&, double)':
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:547: undefined reference to `cv::FileStorage::FileStorage(cv::String const&, int, cv::String const&)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:588: undefined reference to `cvWriteComment'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:604: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:611: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:612: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:614: undefined reference to `cv::Mat::t() const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:615: undefined reference to `cv::Mat::t() const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:626: undefined reference to `cv::Mat::reshape(int, int) const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:628: undefined reference to `cv::Mat::copyTo(cv::_OutputArray const&) const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:547: undefined reference to `cv::FileStorage::~FileStorage()'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:632: undefined reference to `cv::FileStorage::~FileStorage()'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:632: undefined reference to `cv::FileStorage::~FileStorage()'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:547: undefined reference to `cv::FileStorage::~FileStorage()'
camera_calibration.o: In function `cv::FileStorage& cv::operator<< <int>(cv::FileStorage&, int const&)':
/usr/local/include/opencv2/core/persistence.hpp:1064: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
/usr/local/include/opencv2/core/persistence.hpp:1065: undefined reference to `cv::write(cv::FileStorage&, cv::String const&, int)'
camera_calibration.o: In function `cv::FileStorage& cv::operator<< <float>(cv::FileStorage&, float const&)':
/usr/local/include/opencv2/core/persistence.hpp:1064: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
/usr/local/include/opencv2/core/persistence.hpp:1065: undefined reference to `cv::write(cv::FileStorage&, cv::String const&, float)'
camera_calibration.o: In function `cv::FileStorage& cv::operator<< <bool>(cv::FileStorage&, bool const&)':
/usr/local/include/opencv2/core/persistence.hpp:1064: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
/usr/local/include/opencv2/core/persistence.hpp:1065: undefined reference to `cv::write(cv::FileStorage&, cv::String const&, int)'
camera_calibration.o: In function `void cv::operator>><int>(cv::FileNode const&, int&)':
/usr/local/include/opencv2/core/persistence.hpp:1121: undefined reference to `cv::read(cv::FileNode const&, int&, int)'
camera_calibration.o: In function `void cv::operator>><float>(cv::FileNode const&, float&)':
/usr/local/include/opencv2/core/persistence.hpp:1121: undefined reference to `cv::read(cv::FileNode const&, float&, float)'
camera_calibration.o: In function `cv::FileStorage& cv::operator<< <cv::Mat>(cv::FileStorage&, cv::Mat const&)':
/usr/local/include/opencv2/core/persistence.hpp:1064: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
/usr/local/include/opencv2/core/persistence.hpp:1065: undefined reference to `cv::write(cv::FileStorage&, cv::String const&, cv::Mat const&)'
camera_calibration.o: In function `cv::FileStorage& cv::operator<< <double>(cv::FileStorage&, double const&)':
/usr/local/include/opencv2/core/persistence.hpp:1064: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
/usr/local/include/opencv2/core/persistence.hpp:1065: undefined reference to `cv::write(cv::FileStorage&, cv::String const&, double)'
camera_calibration.o: In function `cv::String::String(char const*)':
/usr/local/include/opencv2/core/cvstd.hpp:625: undefined reference to `cv::String::allocate(unsigned long)'
camera_calibration.o: In function `cv::String::~String()':
/usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference to `cv::String::deallocate()'
camera_calibration.o: In function `cv::Mat::Mat(cv::Mat const&)':
/usr/local/include/opencv2/core/mat.inl.hpp:400: undefined reference to `cv::Mat::copySize(cv::Mat const&)'
camera_calibration.o: In function `cv::Mat::Mat(int, int, int, void*, unsigned long)':
/usr/local/include/opencv2/core/mat.inl.hpp:410: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
/usr/local/include/opencv2/core/mat.inl.hpp:426: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
camera_calibration.o: In function `cv::Mat::~Mat()':
/usr/local/include/opencv2/core/mat.inl.hpp:571: undefined reference to `cv::fastFree(void*)'
camera_calibration.o: In function `cv::Mat::operator=(cv::Mat const&)':
/usr/local/include/opencv2/core/mat.inl.hpp:592: undefined reference to `cv::Mat::copySize(cv::Mat const&)'
camera_calibration.o: In function `cv::Mat::row(int) const':
/usr/local/include/opencv2/core/mat.inl.hpp:606: undefined reference to `cv::Mat::Mat(cv::Mat const&, cv::Range const&, cv::Range const&)'
camera_calibration.o: In function `cv::Mat::clone() const':
/usr/local/include/opencv2/core/mat.inl.hpp:643: undefined reference to `cv::Mat::copyTo(cv::_OutputArray const&) const'
camera_calibration.o: In function `cv::Mat::create(int, int, int)':
/usr/local/include/opencv2/core/mat.inl.hpp:663: undefined reference to `cv::Mat::create(int, int const*, int)'
camera_calibration.o: In function `cv::Mat::release()':
/usr/local/include/opencv2/core/mat.inl.hpp:682: undefined reference to `cv::Mat::deallocate()'
camera_calibration.o: In function `cv::Mat::operator()(cv::Range, cv::Range) const':
/usr/local/include/opencv2/core/mat.inl.hpp:692: undefined reference to `cv::Mat::Mat(cv::Mat const&, cv::Range const&, cv::Range const&)'
camera_calibration.o: In function `cv::FileStorage::getFirstTopLevelNode() const':
/usr/local/include/opencv2/core/persistence.hpp:1167: undefined reference to `cv::FileStorage::root(int) const'
camera_calibration.o: In function `cv::FileNode::begin() const':
/usr/local/include/opencv2/core/persistence.hpp:1184: undefined reference to `cv::FileNodeIterator::FileNodeIterator(CvFileStorage const*, CvFileNode const*, unsigned long)'
camera_calibration.o: In function `cv::FileNode::end() const':
/usr/local/include/opencv2/core/persistence.hpp:1185: undefined reference to `cv::FileNode::size() const'
/usr/local/include/opencv2/core/persistence.hpp:1185: undefined reference to `cv::FileNodeIterator::FileNodeIterator(CvFileStorage const*, CvFileNode const*, unsigned long)'
camera_calibration.o: In function `cv::String::String(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/usr/local/include/opencv2/core/cvstd.inl.hpp:81: undefined reference to `cv::String::allocate(unsigned long)'
camera_calibration.o: In function `cv::FileNode::operator std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >[abi:cxx11]() const':
/usr/local/include/opencv2/core/cvstd.inl.hpp:147: undefined reference to `cv::read(cv::FileNode const&, cv::String&, cv::String const&)'
camera_calibration.o: In function `Settings::Settings()':
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:31: undefined reference to `cv::VideoCapture::VideoCapture()'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:31: undefined reference to `cv::VideoCapture::~VideoCapture()'
camera_calibration.o: In function `Settings::read(cv::FileNode const&)':
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:60: undefined reference to `cv::FileNode::operator[](char const*) const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:61: undefined reference to `cv::FileNode::operator[](char const*) const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:62: undefined reference to `cv::FileNode::operator[](char const*) const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:63: undefined reference to `cv::FileNode::operator[](char const*) const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:64: undefined reference to `cv::FileNode::operator[](char const*) const'
camera_calibration.o:/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:65: more undefined references to `cv::FileNode::operator[](char const*) const' follow
camera_calibration.o: In function `Settings::validate()':
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:118: undefined reference to `cv::VideoCapture::open(int)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:120: undefined reference to `cv::VideoCapture::open(cv::String const&)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:121: undefined reference to `cv::VideoCapture::isOpened() const'
camera_calibration.o: In function `Settings::nextImage()':
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:157: undefined reference to `cv::VideoCapture::isOpened() const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:160: undefined reference to `cv::VideoCapture::operator>>(cv::Mat&)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:161: undefined reference to `cv::Mat::copyTo(cv::_OutputArray const&) const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:164: undefined reference to `cv::imread(cv::String const&, int)'
camera_calibration.o: In function `Settings::readStringList(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> > > >&)':
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:172: undefined reference to `cv::FileStorage::FileStorage(cv::String const&, int, cv::String const&)'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:173: undefined reference to `cv::FileStorage::isOpened() const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:176: undefined reference to `cv::FileNode::type() const'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:179: undefined reference to `cv::FileNodeIterator::operator++()'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:172: undefined reference to `cv::FileStorage::~FileStorage()'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:182: undefined reference to `cv::FileStorage::~FileStorage()'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:182: undefined reference to `cv::FileStorage::~FileStorage()'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:172: undefined reference to `cv::FileStorage::~FileStorage()'
camera_calibration.o: In function `Settings::~Settings()':
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:28: undefined reference to `cv::VideoCapture::~VideoCapture()'
/home/paradisolab/Desktop/camera_calibration/camera_calibration.cpp:28: undefined reference to `cv::VideoCapture::~VideoCapture()'
camera_calibration.o: In function `cv::Mat::Mat<cv::Point_<float> >(std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > > const&, bool)':
/usr/local/include/opencv2/core/mat.inl.hpp:484: undefined reference to `cv::Mat::copyTo(cv::_OutputArray const&) const'
camera_calibration.o: In function `cv::Mat::Mat<float>(std::vector<float, std::allocator<float> > const&, bool)':
/usr/local/include/opencv2/core/mat.inl.hpp:484: undefined reference to `cv::Mat::copyTo(cv::_OutputArray const&) const'
collect2: error: ld returned 1 exit status
makefile:9: recipe for target 'camcalib' failed
make: *** [camcalib] Error 1
似乎安装了OpenCV,因为当我键入&#34; pkg-config --libs --cflags opencv&#34;在终端,我得到:
-I/usr/local/include/opencv -I/usr/local/include -L/usr/local/lib -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_viz -lippicv -lopencv_core
我一直在尝试很多东西,但我很难过。如果有人有任何建议,我将不胜感激。