How to compile opencv application using opencv static libs? - c++

I compile OpenCV4 by statically link:
cmake
-DCMAKE_TOOLCHAIN_FILE=../platforms/linux/arm-gnueabi.toolchain.cmake -DCMAKE_INSTALL_PREFIX=~/opencv4-static -DBUILD_SHARED_LIBS=OFF -DBUILD_WITH_STATIC_CRT=ON -DCMAKE_BUILD_TYPE=RELEASE -DOPENCV_GENERATE_PKGCONFIG=ON ../
add the pkgconfig in the path:
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/atmark/opencv4-static/lib/pkgconfig
then compile a sample:
arm-linux-gnueabihf-g++-4.9 -std=c++11 videocapture_basic.cpp -o camera `pkg-config opencv4 --cflags --libs --static`
but got a lot of errors:
/home/atmark/opencv4-static/lib/libopencv_imgcodecs.a(grfmt_exr.cpp.o): undefined reference to `cv::ExrDecoder::readHeader()' :
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x6): `Imf::globalThreadCount()'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x18): `Imf::InputFile::InputFile(char const*, int)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x20): `Imf::InputFile::header() const'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x26): `Imf::Header::dataWindow() const'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x4e): `Imf::InputFile::header() const'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x52): `Imf::hasChromaticities(Imf::Header const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x5a): `Imf::InputFile::header() const'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x5e): `Imf::Header::channels() const'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x68): `Imf::ChannelList::findChannel(char const*) const'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x74): `Imf::ChannelList::findChannel(char const*) const'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x80): `Imf::ChannelList::findChannel(char const*) const'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0xa8): `Imf::InputFile::header() const'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0xac): `Imf::chromaticities(Imf::Header const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0xf8): `Imf::ChannelList::findChannel(char const*) const'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x10c): `Imf::ChannelList::findChannel(char const*) const'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder10readHeaderEv+0x118): `Imf::ChannelList::findChannel(char const*) const'
/home/atmark/opencv4-static/lib/libopencv_imgcodecs.a(grfmt_exr.cpp.o): undefined reference to `cv::ExrDecoder::newDecoder() const' :
grfmt_exr.cpp:(.text._ZNK2cv10ExrDecoder10newDecoderEv+0xba): `Imf::Chromaticities::Chromaticities(Imath::Vec2<float> const&, Imath::Vec2<float> const&, Imath::Vec2<float> const&, Imath::Vec2<float> const&)'
/home/atmark/opencv4-static/lib/libopencv_imgcodecs.a(grfmt_exr.cpp.o): undefined reference to `cv::ExrDecoder::ExrDecoder()' :
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoderC2Ev+0x84): `Imf::Chromaticities::Chromaticities(Imath::Vec2<float> const&, Imath::Vec2<float> const&, Imath::Vec2<float> const&, Imath::Vec2<float> const&)'
/home/atmark/opencv4-static/lib/libopencv_imgcodecs.a(grfmt_exr.cpp.o): undefined reference to `cv::ExrDecoder::readData(cv::Mat&)' :
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x140): `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x14c): `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x19c): `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x1a8): `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x1f2): `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x1fe): `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x24e): `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x25a): `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x2aa): `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x2b6): `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x300): `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x30c): `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x31a): `Imf::FrameBuffer::begin()'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x35a): `Imf::FrameBuffer::end()'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x366): `Imf::InputFile::setFrameBuffer(Imf::FrameBuffer const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x3a2): `Imf::InputFile::readPixels(int, int)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x6e0): `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x6ec): `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0x716): `Imf::InputFile::readPixels(int, int)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0xd46): `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0xd52): `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0xd8c): `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0xd98): `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0xdd0): `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0xddc): `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0xe40): `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0xe4c): `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0xe86): `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0xe92): `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0xee0): `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrDecoder8readDataERNS_3MatE+0xeec): `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
/home/atmark/opencv4-static/lib/libopencv_imgcodecs.a(grfmt_exr.cpp.o): undefined reference to `cv::ExrEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)' :
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x54): `Imf::Header::Header(int, int, float, Imath::Vec2<float> const&, float, Imf::LineOrder, Imf::Compression)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xe0): `Imf::Header::channels()'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xf2): `Imf::Channel::Channel(Imf::PixelType, int, int, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xfe): `Imf::ChannelList::insert(char const*, Imf::Channel const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x108): `Imf::globalThreadCount()'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x118): `Imf::OutputFile::OutputFile(char const*, Imf::Header const&, int)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x198): `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1a8): `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1b0): `Imf::OutputFile::setFrameBuffer(Imf::FrameBuffer const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1b8): `Imf::OutputFile::writePixels(int)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x218): `Imf::OutputFile::~OutputFile()'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x21e): `Imf::Header::~Header()'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x252): `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x262): `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x288): `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x294): `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2b8): `Imf::Slice::Slice(Imf::PixelType, char*, unsigned int, unsigned int, int, int, double, bool, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2c4): `Imf::FrameBuffer::insert(char const*, Imf::Slice const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2ca): `Imf::Header::channels()'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2dc): `Imf::Channel::Channel(Imf::PixelType, int, int, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2e8): `Imf::ChannelList::insert(char const*, Imf::Channel const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2ee): `Imf::Header::channels()'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x300): `Imf::Channel::Channel(Imf::PixelType, int, int, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x30c): `Imf::ChannelList::insert(char const*, Imf::Channel const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x312): `Imf::Header::channels()'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x324): `Imf::Channel::Channel(Imf::PixelType, int, int, bool)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x330): `Imf::ChannelList::insert(char const*, Imf::Channel const&)'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x366): `Imf::Header::~Header()'
grfmt_exr.cpp:(.text._ZN2cv10ExrEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x456): `Imf::OutputFile::~OutputFile()'
/home/atmark/opencv4-static/lib/libopencv_imgcodecs.a(grfmt_jpeg2000.cpp.o): undefined reference to `cv::JasperInitializer::~JasperInitializer()' :
grfmt_jpeg2000.cpp:(.text._ZN2cv17JasperInitializerD2Ev[_ZN2cv17JasperInitializerD5Ev]+0x4): `jas_cleanup'
/home/atmark/opencv4-static/lib/libopencv_imgcodecs.a(grfmt_jpeg2000.cpp.o): undefined reference to `cv::Jpeg2KDecoder_close(cv::Jpeg2KDecoder*)' :
grfmt_jpeg2000.cpp:(.text._ZN2cvL19Jpeg2KDecoder_closeEPNS_13Jpeg2KDecoderE+0x8): `jas_stream_close'
grfmt_jpeg2000.cpp:(.text._ZN2cvL19Jpeg2KDecoder_closeEPNS_13Jpeg2KDecoderE+0x14): `jas_image_destroy'
/home/atmark/opencv4-static/lib/libopencv_imgcodecs.a(grfmt_jpeg2000.cpp.o): undefined reference to `cv::Jpeg2KDecoder::readHeader()' :
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder10readHeaderEv+0x14): `jas_stream_close'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder10readHeaderEv+0x22): `jas_image_destroy'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder10readHeaderEv+0x32): `jas_stream_fopen'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder10readHeaderEv+0x46): `jas_image_decode'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder10readHeaderEv+0x13e): `jas_stream_close'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder10readHeaderEv+0x14c): `jas_image_destroy'
/home/atmark/opencv4-static/lib/libopencv_imgcodecs.a(grfmt_jpeg2000.cpp.o): undefined reference to `cv::Jpeg2KDecoder::close()' :
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder5closeEv+0x8): `jas_stream_close'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder5closeEv+0x14): `jas_image_destroy'
/home/atmark/opencv4-static/lib/libopencv_imgcodecs.a(grfmt_jpeg2000.cpp.o): undefined reference to `cv::Jpeg2KDecoder::readData(cv::Mat&)' :
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0xc4): `jas_image_getcmptbytype'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0xd0): `jas_image_getcmptbytype'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0xdc): `jas_image_getcmptbytype'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x146): `jas_matrix_create'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x160): `jas_image_readcmpt'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x19a): `jas_matrix_destroy'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x2de): `jas_image_getcmptbytype'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x2f0): `jas_cmprof_createfromclrspc'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x302): `jas_image_chclrspc'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x30e): `jas_image_destroy'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x31a): `jas_cmprof_destroy'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x396): `jas_matrix_destroy'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x408): `jas_cmprof_destroy'
/home/atmark/opencv4-static/lib/libopencv_imgcodecs.a(grfmt_jpeg2000.cpp.o): undefined reference to `cv::Jpeg2KEncoder::writeComponent8u(void*, cv::Mat const&)' :
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder16writeComponent8uEPvRKNS_3MatE+0x1e): `jas_matrix_create'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder16writeComponent8uEPvRKNS_3MatE+0x8a): `jas_image_writecmpt'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder16writeComponent8uEPvRKNS_3MatE+0xa2): `jas_matrix_destroy'
/home/atmark/opencv4-static/lib/libopencv_imgcodecs.a(grfmt_jpeg2000.cpp.o): undefined reference to `cv::Jpeg2KEncoder::writeComponent16u(void*, cv::Mat const&)' :
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder17writeComponent16uEPvRKNS_3MatE+0x20): `jas_matrix_create'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder17writeComponent16uEPvRKNS_3MatE+0x8c): `jas_image_writecmpt'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder17writeComponent16uEPvRKNS_3MatE+0xa0): `jas_matrix_destroy'
/home/atmark/opencv4-static/lib/libopencv_imgcodecs.a(grfmt_jpeg2000.cpp.o): undefined reference to `cv::Jpeg2KEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)' :
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x6c): `jas_image_create'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xa4): `jas_image_destroy'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xb8): `jas_image_create'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xec): `jas_stream_fopen'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xfa): `jas_image_strtofmt'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x108): `jas_image_encode'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x114): `jas_stream_close'
/home/atmark/opencv4-static/lib/libopencv_imgcodecs.a(grfmt_jpeg2000.cpp.o): undefined reference to `_GLOBAL__sub_I_grfmt_jpeg2000.cpp' :
grfmt_jpeg2000.cpp:(.text.startup._GLOBAL__sub_I_grfmt_jpeg2000.cpp+0x2): `jas_init'
/home/atmark/opencv4-static/lib/libopencv_imgcodecs.a(grfmt_jpeg.cpp.o): undefined reference to `cv::my_jpeg_load_dht(jpeg_decompress_struct*, unsigned char*, JHUFF_TBL**, JHUFF_TBL**) [clone .constprop.59]' :
grfmt_jpeg.cpp:(.text.unlikely._ZN2cvL16my_jpeg_load_dhtEP22jpeg_decompress_structPhPP9JHUFF_TBLS5_.constprop.59+0xaa): `jpeg_alloc_huff_table'
/home/atmark/opencv4-static/lib/libopencv_imgcodecs.a(grfmt_jpeg.cpp.o): undefined reference to `cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)' :
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x76): `jpeg_CreateCompress'
grfmt_jpeg.cpp:
/home/atmark/opencv4-static/lib/libopencv_imgproc.a(color_rgb.cpp.o): undefined reference to `cv::hal::cvtGraytoBGR(unsigned char const*, unsigned int, unsigned char*, unsigned int, int, int, int, int)' :
color_rgb.cpp:(.text._ZN2cv3hal12cvtGraytoBGREPKhjPhjiiii+0x82): `carotene_o4t::isSupportedConfiguration()'
/home/atmark/opencv4-static/lib/libopencv_imgproc.a(color_yuv.cpp.o): undefined reference to `TegraCvtColor_rgb2ycrcb_Invoker::operator()(cv::Range const&) const' :
color_yuv.cpp:(.text._ZNK31TegraCvtColor_rgb2ycrcb_InvokerclERKN2cv5RangeE[_ZNK31TegraCvtColor_rgb2ycrcb_InvokerclERKN2cv5RangeE]+0x2a): `carotene_o4t::rgb2ycrcb(carotene_o4t::Size2D const&, unsigned char const*, int, unsigned char*, int)'
/home/atmark/opencv4-static/lib/libopencv_imgproc.a(color_yuv.cpp.o): undefined reference to `TegraCvtColor_bgr2ycrcb_Invoker::operator()(cv::Range const&) const' :
color_yuv.cpp:(.text._ZNK31TegraCvtColor_bgr2ycrcb_InvokerclERKN2cv5RangeE[_ZNK31TegraCvtColor_bgr2ycrcb_InvokerclERKN2cv5RangeE]+0x2a): `carotene_o4t::bgr2ycrcb(carotene_o4t::Size2D const&, unsigned char const*, int, unsigned char*, int)'
/home/atmark/opencv4-static/lib/libopencv_imgproc.a(color_yuv.cpp.o): undefined reference to `TegraCvtColor_rgbx2ycrcb_Invoker::operator()(cv::Range const&) const' :
color_yuv.cpp:(.text._ZNK32TegraCvtColor_rgbx2ycrcb_InvokerclERKN2cv5RangeE[_ZNK32TegraCvtColor_rgbx2ycrcb_InvokerclERKN2cv5RangeE]+0x2a): `carotene_o4t::rgbx2ycrcb(carotene_o4t::Size2D const&, unsigned char const*, int, unsigned char*, int)'
/home/atmark/opencv4-static/lib/libopencv_imgproc.a(color_yuv.cpp.o): undefined reference to `TegraCvtColor_bgrx2ycrcb_Invoker::operator()(cv::Range const&) const' :
color_yuv.cpp:(.text._ZNK32TegraCvtColor_bgrx2ycrcb_InvokerclERKN2cv5RangeE[_ZNK32TegraCvtColor_bgrx2ycrcb_InvokerclERKN2cv5RangeE]+0x2a): `carotene_o4t::bgrx2ycrcb(carotene_o4t::Size2D const&, unsigned char const*, int, unsigned char*, int)'
/home/atmark/opencv4-static/lib/libopencv_imgproc.a(color_yuv.cpp.o): undefined reference to `cv::hal::cvtBGRtoYUV(unsigned char const*, unsigned int, unsigned char*, unsigned int, int, int, int, int, bool, bool)' :
color_yuv.cpp:(.text._ZN2cv3hal11cvtBGRtoYUVEPKhjPhjiiiibb+0xd2): `carotene_o4t::isSupportedConfiguration()'
/home/atmark/opencv4-static/lib/libopencv_imgproc.a(color_yuv.cpp.o): undefined reference to `cv::hal::cvtTwoPlaneYUVtoBGR(unsigned char const*, unsigned int, unsigned char*, unsigned int, int, int, int, bool, int)' :
color_yuv.cpp:(.text._ZN2cv3hal19cvtTwoPlaneYUVtoBGREPKhjPhjiiibi+0x22): `carotene_o4t::isSupportedConfiguration()'
color_yuv.cpp:(.text._ZN2cv3hal19cvtTwoPlaneYUVtoBGREPKhjPhjiiibi+0x88): `carotene_o4t::yuv420i2bgr(carotene_o4t::Size2D const&, unsigned char const*, int, unsigned char const*, int, unsigned char*, int)'
color_yuv.cpp:(.text._ZN2cv3hal19cvtTwoPlaneYUVtoBGREPKhjPhjiiibi+0xc2): `carotene_o4t::yuv420i2rgbx(carotene_o4t::Size2D const&, unsigned char const*, int, unsigned char const*, int, unsigned char*, int)'
color_yuv.cpp:(.text._ZN2cv3hal19cvtTwoPlaneYUVtoBGREPKhjPhjiiibi+0xec): `carotene_o4t::yuv420sp2rgb(carotene_o4t::Size2D const&, unsigned char const*, int, unsigned char const*, int, unsigned char*, int)'
color_yuv.cpp:(.text._ZN2cv3hal19cvtTwoPlaneYUVtoBGREPKhjPhjiiibi+0x116): `carotene_o4t::yuv420sp2rgbx(carotene_o4t::Size2D const&, unsigned char const*, int, unsigned char const*, int, unsigned char*, int)'
color_yuv.cpp:(.text._ZN2cv3hal19cvtTwoPlaneYUVtoBGREPKhjPhjiiibi+0x128): `carotene_o4t::yuv420i2rgb(carotene_o4t::Size2D const&, unsigned char const*, int, unsigned char const*, int, unsigned char*, int)'
color_yuv.cpp:(.text._ZN2cv3hal19cvtTwoPlaneYUVtoBGREPKhjPhjiiibi+0x13a): `carotene_o4t::yuv420i2bgrx(carotene_o4t::Size2D const&, unsigned char const*, int, unsigned char const*, int, unsigned char*, int)'
color_yuv.cpp:(.text._ZN2cv3hal19cvtTwoPlaneYUVtoBGREPKhjPhjiiibi+0x14c): `carotene_o4t::yuv420sp2bgr(carotene_o4t::Size2D const&, unsigned char const*, int, unsigned char const*, int, unsigned char*, int)'
color_yuv.cpp:(.text._ZN2cv3hal19cvtTwoPlaneYUVtoBGREPKhjPhjiiibi+0x152): `carotene_o4t::yuv420sp2bgrx(carotene_o4t::Size2D const&, unsigned char const*, int, unsigned char const*, int, unsigned char*, int)'
/home/atmark/opencv4-static/lib/libopencv_core.a(persistence.cpp.o): undefined reference to `cv::FileStorage::Impl::rewind()' :
persistence.cpp:(.text._ZN2cv11FileStorage4Impl6rewindEv[_ZN2cv11FileStorage4Impl6rewindEv]+0x1a): `gzrewind'
/home/atmark/opencv4-static/lib/libopencv_core.a(persistence.cpp.o): undefined reference to `cv::FileStorage::Impl::closeFile()' :
persistence.cpp:(.text._ZN2cv11FileStorage4Impl9closeFileEv[_ZN2cv11FileStorage4Impl9closeFileEv]+0x24): `gzclose'
/home/atmark/opencv4-static/lib/libopencv_core.a(persistence.cpp.o): undefined reference to `cv::FileStorage::Impl::eof()' :
persistence.cpp:(.text._ZN2cv11FileStorage4Impl3eofEv[_ZN2cv11FileStorage4Impl3eofEv]+0x38): `gzeof'
/home/atmark/opencv4-static/lib/libopencv_core.a(persistence.cpp.o): undefined reference to `cv::FileStorage::Impl::puts(char const*)' :
persistence.cpp:(.text._ZN2cv11FileStorage4Impl4putsEPKc[_ZN2cv11FileStorage4Impl4putsEPKc]+0x6a): `gzputs'
/home/atmark/opencv4-static/lib/libopencv_core.a(persistence.cpp.o): undefined reference to `cv::FileStorage::Impl::gets(char*, int)' :
persistence.cpp:(.text._ZN2cv11FileStorage4Impl4getsEPci[_ZN2cv11FileStorage4Impl4getsEPci]+0x128): `gzgets'
/home/atmark/opencv4-static/lib/libopencv_core.a(persistence.cpp.o): undefined reference to `cv::FileStorage::Impl::gets()' :
persistence.cpp:(.text._ZN2cv11FileStorage4Impl4getsEv[_ZN2cv11FileStorage4Impl4getsEv]+0x104): `gzeof'
/home/atmark/opencv4-static/lib/libopencv_core.a(persistence.cpp.o): undefined reference to `cv::FileStorage::Impl::release(std::string*) [clone .constprop.294]' :
persistence.cpp:(.text._ZN2cv11FileStorage4Impl7releaseEPSs.constprop.294+0x1e4): `gzclose'
/home/atmark/opencv4-static/lib/libopencv_core.a(persistence.cpp.o): undefined reference to `cv::FileStorage::releaseAndGetString()' :
persistence.cpp:(.text._ZN2cv11FileStorage19releaseAndGetStringEv+0x25c): `gzclose'
/home/atmark/opencv4-static/lib/libopencv_core.a(persistence.cpp.o): undefined reference to `cv::FileStorage::Impl::open(char const*, int, char const*)' :
persistence.cpp:(.text._ZN2cv11FileStorage4Impl4openEPKciS3_[_ZN2cv11FileStorage4Impl4openEPKciS3_]+0x69e): `gzopen'
persistence.cpp:(.text._ZN2cv11FileStorage4Impl4openEPKciS3_[_ZN2cv11FileStorage4Impl4openEPKciS3_]+0x7d0): `gzrewind'
collect2: error: ld returned 1 exit status
it looks like didn't link the 3rd libs.
I want a version of OpenCV libs with dependencies(libstd..) or complete static OpenCV libs.
Found something:
Looks like it's a BUG of pkg-config,
pkg-config --static not worked. so the 3rd libs didn't link.
arm-linux-gnueabihf-g++-4.9 -std=c++11 videocapture_basic.cpp -o camera `pkg-config opencv4 --cflags --libs` -L/home/atmark/opencv4-static/lib/opencv4/3rdparty -lquirc -llibprotobuf -ltegra_hal -lzlib -llibjpeg-turbo -llibwebp -llibpng -llibtiff -llibjasper -lIlmImf -L/home/atmark/opencv-4.0.1/static-build/lib -lade -ldl -lm -lpthread -lrt
Now error remains only:
arm-linux-gnueabihf-g++-4.9 -std=c++11 videocapture_basic.cpp -o camera `pkg-config opencv4 --cflags --libs` -L/home/atmark/opencv4-static/lib/opencv4/3rdparty -lquirc -llibprotobuf -ltegra_hal -lzlib -llibjpeg-turbo -llibwebp -llibpng -llibtiff -llibjasper -lIlmImf -L/home/atmark/opencv-4.0.1/static-build/lib -lade -ldl -lm -lpthread -lrt
/home/atmark/opencv4-static/lib/opencv4/3rdparty/libIlmImf.a(ImfZipCompressor.cpp.o): undefined reference to `Imf::ZipCompressor::compress(char const*, int, int, char const*&)' :
ImfZipCompressor.cpp:(.text._ZN3Imf13ZipCompressor8compressEPKciiRS2_+0xa0): `compress'
/home/atmark/opencv4-static/lib/opencv4/3rdparty/libIlmImf.a(ImfZipCompressor.cpp.o): undefined reference to `Imf::ZipCompressor::uncompress(char const*, int, int, char const*&)' :
ImfZipCompressor.cpp:(.text._ZN3Imf13ZipCompressor10uncompressEPKciiRS2_+0x28): `uncompress'
/home/atmark/opencv4-static/lib/opencv4/3rdparty/libIlmImf.a(ImfPxr24Compressor.cpp.o): undefined reference to `Imf::Pxr24Compressor::compress(char const*, int, Imath::Box<Imath::Vec2<int> >, char const*&) [clone .part.3]' :
ImfPxr24Compressor.cpp:(.text._ZN3Imf15Pxr24Compressor8compressEPKciN5Imath3BoxINS3_4Vec2IiEEEERS2_.part.3+0x17e): `compress'
/home/atmark/opencv4-static/lib/opencv4/3rdparty/libIlmImf.a(ImfPxr24Compressor.cpp.o): undefined reference to `Imf::Pxr24Compressor::uncompress(char const*, int, Imath::Box<Imath::Vec2<int> >, char const*&) [clone .part.4]' :
ImfPxr24Compressor.cpp:(.text._ZN3Imf15Pxr24Compressor10uncompressEPKciN5Imath3BoxINS3_4Vec2IiEEEERS2_.part.4+0x28): `uncompress'
collect2: error: ld returned 1 exit status

Problem solved by disabling OpenEXR -DWITH_OPENEXR=OFF of OpenCV:
cmake -DCMAKE_TOOLCHAIN_FILE=../platforms/linux/arm-gnueabi.toolchain.cmake -DCMAKE_INSTALL_PREFIX=~/opencv4-static -DBUILD_SHARED_LIBS=OFF -DBUILD_WITH_STATIC_CRT=ON -DCMAKE_BUILD_TYPE=RELEASE -DOPENCV_GENERATE_PKGCONFIG=ON -DWITH_OPENEXR=OFF ../
And compile the application with static std libs:
arm-linux-gnueabihf-g++-4.9 -std=c++11 videocapture_basic.cpp -o camera `pkg-config opencv4 --cflags --libs` -L/home/atmark/opencv4-static/lib/opencv4/3rdparty -lquirc -llibprotobuf -ltegra_hal -lzlib -llibjpeg-turbo -llibwebp -llibpng -llibtiff -llibjasper -L/home/atmark/opencv-4.0.1/static-build/lib -lade -ldl -lm -lpthread -lrt -static -static-libgcc -static-libstdc++

Related

cannot compile standalone asio with exceptions turned off

I'm trying to build project which uses standalone asio as dependency. Problem is that with exceptions turned off (-fno-exceptions), I have to define throw_exception function (link to boost documentation), but no matter how I define that function, linker throws undefined reference.
This is how I've tried to define throw_exception:
#define ASIO_NO_EXCEPTIONS
#include <asio/detail/throw_exception.hpp>
template <class E>
void asio::detail::throw_exception(E const& e) {
// do something
}
I receive these linking errors:
/usr/bin/ld: libsioclient.a(sio_socket.cpp.o): in function `asio::detail::do_throw_error(std::error_code const&, char const*) [clone .isra.0]':
sio_socket.cpp:(.text+0x333): undefined reference to `void asio::detail::throw_exception<std::system_error>(std::system_error const&)'
/usr/bin/ld: _libsioclient.a(sio_socket.cpp.o): in function `void asio::execution::detail::any_executor_base::query_fn<void, asio::execution::prefer_only<asio::execution::detail::outstanding_work::tracked_t<0> > >(void*, void const*, void const*)':
sio_socket.cpp:(.text._ZN4asio9execution6detail17any_executor_base8query_fnIvNS0_11prefer_onlyINS1_16outstanding_work9tracked_tILi0EEEEEEEvPvPKvSB_[_ZN4asio9execution6detail17any_executor_base8query_fnIvNS0_11prefer_onlyINS1_16outstanding_work9tracked_tILi0EEEEEEEvPvPKvSB_]+0x28): undefined reference to `void asio::detail::throw_exception<asio::execution::bad_executor>(asio::execution::bad_executor const&)'
/usr/bin/ld: libsioclient.a(sio_socket.cpp.o): in function `void asio::execution::detail::any_executor_base::query_fn<void, asio::execution::prefer_only<asio::execution::detail::outstanding_work::untracked_t<0> > >(void*, void const*, void const*)':
sio_socket.cpp:(.text._ZN4asio9execution6detail17any_executor_base8query_fnIvNS0_11prefer_onlyINS1_16outstanding_work11untracked_tILi0EEEEEEEvPvPKvSB_[_ZN4asio9execution6detail17any_executor_base8query_fnIvNS0_11prefer_onlyINS1_16outstanding_work11untracked_tILi0EEEEEEEvPvPKvSB_]+0x28): undefined reference to `void asio::detail::throw_exception<asio::execution::bad_executor>(asio::execution::bad_executor const&)'
/usr/bin/ld: libsioclient.a(sio_socket.cpp.o): in function `void asio::execution::detail::any_executor_base::query_fn<void, asio::execution::prefer_only<asio::execution::detail::relationship::fork_t<0> > >(void*, void const*, void const*)':
sio_socket.cpp:(.text._ZN4asio9execution6detail17any_executor_base8query_fnIvNS0_11prefer_onlyINS1_12relationship6fork_tILi0EEEEEEEvPvPKvSB_[_ZN4asio9execution6detail17any_executor_base8query_fnIvNS0_11prefer_onlyINS1_12relationship6fork_tILi0EEEEEEEvPvPKvSB_]+0x28): undefined reference to `void asio::detail::throw_exception<asio::execution::bad_executor>(asio::execution::bad_executor const&)'
/usr/bin/ld: libsioclient.a(sio_socket.cpp.o): in function `void asio::execution::detail::any_executor_base::query_fn<void, asio::execution::prefer_only<asio::execution::detail::relationship::continuation_t<0> > >(void*, void const*, void const*)':
sio_socket.cpp:(.text._ZN4asio9execution6detail17any_executor_base8query_fnIvNS0_11prefer_onlyINS1_12relationship14continuation_tILi0EEEEEEEvPvPKvSB_[_ZN4asio9execution6detail17any_executor_base8query_fnIvNS0_11prefer_onlyINS1_12relationship14continuation_tILi0EEEEEEEvPvPKvSB_]+0x28): undefined reference to `void asio::detail::throw_exception<asio::execution::bad_executor>(asio::execution::bad_executor const&)'
/usr/bin/ld: libsioclient.a(sio_socket.cpp.o): in function `void asio::execution::detail::any_executor_base::query_fn<void, asio::execution::context_as_t<asio::execution_context&> >(void*, void const*, void const*)':
sio_socket.cpp:(.text._ZN4asio9execution6detail17any_executor_base8query_fnIvNS0_12context_as_tIRNS_17execution_contextEEEEEvPvPKvSA_[_ZN4asio9execution6detail17any_executor_base8query_fnIvNS0_12context_as_tIRNS_17execution_contextEEEEEvPvPKvSA_]+0x28): undefined reference to `void asio::detail::throw_exception<asio::execution::bad_executor>(asio::execution::bad_executor const&)'
/usr/bin/ld: libsioclient.a(sio_socket.cpp.o):sio_socket.cpp:(.text._ZN4asio9execution6detail17any_executor_base10require_fnINS0_12any_executorIJNS0_12context_as_tIRNS_17execution_contextEEENS1_8blocking7never_tILi0EEENS0_11prefer_onlyINS9_10possibly_tILi0EEEEENSC_INS1_16outstanding_work9tracked_tILi0EEEEENSC_INSG_11untracked_tILi0EEEEENSC_INS1_12relationship6fork_tILi0EEEEENSC_INSN_14continuation_tILi0EEEEEEEEvS8_EET_PKvSX_[_ZN4asio9execution6detail17any_executor_base10require_fnINS0_12any_executorIJNS0_12context_as_tIRNS_17execution_contextEEENS1_8blocking7never_tILi0EEENS0_11prefer_onlyINS9_10possibly_tILi0EEEEENSC_INS1_16outstanding_work9tracked_tILi0EEEEENSC_INSG_11untracked_tILi0EEEEENSC_INS1_12relationship6fork_tILi0EEEEENSC_INSN_14continuation_tILi0EEEEEEEEvS8_EET_PKvSX_]+0x2d): more undefined references to `void asio::detail::throw_exception<asio::execution::bad_executor>(asio::execution::bad_executor const&)' follow
/usr/bin/ld: libsioclient.a(sio_socket.cpp.o): in function `asio::detail::scheduler::scheduler(asio::execution_context&, int, bool, asio::detail::scheduler_task* (*)(asio::execution_context&)) [clone .part.0]':
sio_socket.cpp:(.text._ZN4asio6detail9schedulerC2ERNS_17execution_contextEibPFPNS0_14scheduler_taskES3_E.part.0[_ZN4asio6detail9schedulerC5ERNS_17execution_contextEibPFPNS0_14scheduler_taskES3_E]+0x228): undefined reference to `void asio::detail::throw_exception<std::system_error>(std::system_error const&)'
/usr/bin/ld: libsioclient.a(sio_socket.cpp.o): in function `asio::detail::epoll_reactor::notify_fork(asio::execution_context::fork_event)':
sio_socket.cpp:(.text._ZN4asio6detail13epoll_reactor11notify_forkENS_17execution_context10fork_eventE[_ZN4asio6detail13epoll_reactor11notify_forkENS_17execution_context10fork_eventE]+0x375): undefined reference to `void asio::detail::throw_exception<std::system_error>(std::system_error const&)'
/usr/bin/ld: libsioclient.a(sio_socket.cpp.o): in function `asio::detail::scheduler::scheduler(asio::execution_context&, int, bool, asio::detail::scheduler_task* (*)(asio::execution_context&))':
sio_socket.cpp:(.text._ZN4asio6detail9schedulerC2ERNS_17execution_contextEibPFPNS0_14scheduler_taskES3_E[_ZN4asio6detail9schedulerC5ERNS_17execution_contextEibPFPNS0_14scheduler_taskES3_E]+0x24a): undefined reference to `void asio::detail::throw_exception<std::system_error>(std::system_error const&)'
/usr/bin/ld: sio_socket.cpp:(.text._ZN4asio6detail9schedulerC2ERNS_17execution_contextEibPFPNS0_14scheduler_taskES3_E[_ZN4asio6detail9schedulerC5ERNS_17execution_contextEibPFPNS0_14scheduler_taskES3_E]+0x4f7): undefined reference to `void asio::detail::throw_exception<std::system_error>(std::system_error const&)'
/usr/bin/ld: libsioclient.a(sio_socket.cpp.o): in function `asio::execution_context::service* asio::detail::service_registry::create<asio::detail::epoll_reactor, asio::execution_context>(void*)':
sio_socket.cpp:(.text._ZN4asio6detail16service_registry6createINS0_13epoll_reactorENS_17execution_contextEEEPNS4_7serviceEPv[_ZN4asio6detail16service_registry6createINS0_13epoll_reactorENS_17execution_contextEEEPNS4_7serviceEPv]+0x5d6): undefined reference to `void asio::detail::throw_exception<std::system_error>(std::system_error const&)'
/usr/bin/ld: libsioclient.a(sio_client_impl.cpp.o): in function `std::_Function_handler<void (bool, std::shared_ptr<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const> const&), sio::client_impl::on_ping()::{lambda(bool, std::shared_ptr<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const>)#1}>::_M_invoke(std::_Any_data const&, bool&&, std::shared_ptr<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const> const&)':
sio_client_impl.cpp:(.text+0x3c40): undefined reference to `websocketpp::endpoint<websocketpp::connection<websocketpp::config::asio_client>, websocketpp::config::asio_client>::send(std::weak_ptr<void>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, websocketpp::frame::opcode::value)'
/usr/bin/ld: libsioclient.a(sio_client_impl.cpp.o): in function `sio::client_impl::connect_impl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
sio_client_impl.cpp:(.text+0x988c): undefined reference to `websocketpp::connection<websocketpp::config::asio_client>::replace_header(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
How to properly define throw_exception function or if I'm missing something, how can these errors be solved?
You can try this, log() is the imaginary function you already use for logging ...
// somechere in a cpp file, preferably.
#include <boost/asio.hpp>
// ...
namespace boost::asio::detail {
template<>
void throw_exception(const asio::execution::bad_executor& e)
{
// throw e; // this is what the original function does
LOG("asio::execution::bad_executor thrown\n"); // etc...
exit(3); // That's all you can do at this point.
}
template<>
void throw_exception(const std::system_error& e)
{
LOG("std::system_error thrown\n"); // etc...
exit(3); // That's all you can do at this point.
}
}
You may need to declare more specializations as you go along.
I find solution. Problem was that compiler threw implementation of throw_exception from code while compiling, and when linker tried to find that function, there simply was no throw_exception. I made it like this:
namespace asio::detail {
template <typename Exception> void throw_exception(const Exception& e) {
std::cerr << "Something went wrong..." << std::endl;
std::terminate();
}
}; // namespace asio::detail
If I call this function somewhere, I don't receive linking errors. Probably, I have to implement some kind of error handling instead of that and find a solution to make this function properly compiled and linked, but, at least, I've found a reason of that strange behaviour.

AppData\Local\Temp\cc59LXDc.o:test1.cpp: undefined reference to `constructNewObjectOfClass(JNIEnv_*, _jthrowable**, char const*, char const*, ...)'

Obijective : To access hadoop cluster file(HDFS read/write) through c++ code. Windows 7 operating system.
Below is my sample code
#include "hdfs.h"
#include "hdfs.cpp"
int main(int argc, char **argv) {
hdfsFS fs =hdfsConnect( "localhost" , 9000);
return 0
}
NOTE: I have single node hadoop cluster up and running.
g++ test1.cpp
Getting below error stack trace for above command:
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x60): undefined r
eference to `constructNewObjectOfClass(JNIEnv_*, _jthrowable**, char const*, cha
r const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xe1): undefined r
eference to `classNameOfObject(_jobject*, JNIEnv_*)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x242): undefined
reference to `hdfsConnectAsUser'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x296): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2d7): undefined
reference to `constructNewObjectOfClass(JNIEnv_*, _jthrowable**, char const*, ch
ar const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x38b): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x437): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x4cc): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x5e4): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x671): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x6f8): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x77f): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x7e5): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x95e): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xa62): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xb0f): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xba0): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xc45): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xce9): more undef
ined references to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jo
bject*, char const*, char const*, char const*, ...)' follow
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xe53): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xedd): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xf74): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject*
, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0xff2): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x10fd): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x11d8): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1300): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x13cf): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1522): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1587): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1636): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x167f): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1710): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x17ae): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x17f8): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x189f): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x18ed): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x19ab): undefined
reference to `constructNewObjectOfClass(JNIEnv_*, _jthrowable**, char const*, c
har const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1a8c): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1ad5): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1b93): undefined
reference to `constructNewObjectOfClass(JNIEnv_*, _jthrowable**, char const*, c
har const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1c74): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1cbd): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1d54): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1dd2): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1eb5): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1f57): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x1fc9): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2057): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x212b): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x21ca): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2224): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x22bf): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x231a): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x23b9): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x240d): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x252f): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x257e): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x25d5): undefined
reference to `constructNewObjectOfClass(JNIEnv_*, _jthrowable**, char const*, c
har const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x267c): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x26e9): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2818): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x28aa): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2948): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2a0d): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2b48): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2e40): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2ebe): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2f1a): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2f56): undefined
reference to `globalClassReference(char const*, JNIEnv_*)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x2ff6): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x3045): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x3081): undefined
reference to `globalClassReference(char const*, JNIEnv_*)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x3121): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x31b2): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x3241): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x32c2): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x3347): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x33e7): more unde
fined references to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _j
object*, char const*, char const*, char const*, ...)' follow
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x3ade): undefined
reference to `getJNIEnv()'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x3b83): undefined
reference to `invokeMethod(JNIEnv_*, jvalue*, _jthrowable**, MethType, _jobject
*, char const*, char const*, char const*, ...)'
C:\Users\anant\AppData\Local\Temp\cc59LXDc.o:test1.cpp:(.text+0x3ce6): undefined
reference to `getJNIEnv()'
collect2.exe: error: ld returned 1 exit status
Did you install the library ?
Add linker settings and add linker search directories.

C++ OpenCV 3.1.0 linking error (ubuntu)

I am a C++ newbie trying to compile some OpenCV tutorial code.
I'm running Ubuntu 16.04, and I installed OpenCV 3.1.0 with this script: https://github.com/milq/scripts-ubuntu-debian/blob/master/install-opencv.sh
The source file I'm trying to compile is here:
https://github.com/opencv/opencv/blob/master/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp
I wrote this 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
When I "make", the camera_calibration.o object file is generated, but I get the following error during linking:
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
It seems OpenCV is installed, because when I type "pkg-config --libs --cflags opencv" in terminal, I get:
-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
I've been trying lots of things, but I'm stumped. If anyone has any advice, I would greatly appreciate it.

C++ MongoDB legacy client tutorial compile error

UPDATE
Solved the issue. The was the structure of the g++ command. This one worked for me:
g++ tutorial.cpp -I/opt/local/include -I/usr/include/boost -L/opt/local/lib -lmongoclient -lboost_thread -lboost_system -lboost_regex -o tutorial
OS: Ubuntu 16.04 64-bit
Following this tutorial:
https://mongodb.github.io/mongo-cxx-driver/legacy-v1/tutorial/
I'm able to build the mongodb-client using SCons with no issue.
mongo folder of header files here:
/opt/local/include
libmongoclient.a file here:
/opt/local/lib
Code is as follows, same as the tutorial:
#include <cstdlib>
#include <iostream>
#include "mongo/client/dbclient.h" // for the driver
void run() {
mongo::DBClientConnection c;
c.connect("localhost");
}
int main() {
mongo::client::initialize();
try {
run();
std::cout << "connected ok" << std::endl;
} catch( const mongo::DBException &e ) {
std::cout << "caught " << e.what() << std::endl;
}
return EXIT_SUCCESS;
}
This is the command I'm using to compile:
g++ -I/opt/local/include -L/opt/local/lib -pthread -lmongoclient -lboost_thread -lboost_system -lboost_filesystem -lboost_program_options tutorial.cpp -o tutorial
I receive the following error
/tmp/cceJe78D.o: In function `run()':
tutorial.cpp:(.text+0x34): undefined reference to `mongo::DBClientConnection::DBClientConnection(bool, mongo::DBClientReplicaSet*, double)'
/tmp/cceJe78D.o: In function `main':
tutorial.cpp:(.text+0x12f): undefined reference to `mongo::client::Options::Options()'
tutorial.cpp:(.text+0x148): undefined reference to `mongo::client::initialize(mongo::client::Options const&)'
/tmp/cceJe78D.o: In function `__static_initialization_and_destruction_0(int, int)':
tutorial.cpp:(.text+0x299): undefined reference to `boost::system::generic_category()'
tutorial.cpp:(.text+0x2a5): undefined reference to `boost::system::generic_category()'
tutorial.cpp:(.text+0x2b1): undefined reference to `boost::system::system_category()'
/tmp/cceJe78D.o: In function `mongo::DBException::DBException(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)':
tutorial.cpp:(.text._ZN5mongo11DBExceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi[_ZN5mongo11DBExceptionC5ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi]+0x21): undefined reference to `vtable for mongo::DBException'
/tmp/cceJe78D.o: In function `mongo::DBException::~DBException()':
tutorial.cpp:(.text._ZN5mongo11DBExceptionD2Ev[_ZN5mongo11DBExceptionD5Ev]+0x10): undefined reference to `vtable for mongo::DBException'
/tmp/cceJe78D.o: In function `mongo::DBException::addContext(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
tutorial.cpp:(.text._ZN5mongo11DBException10addContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN5mongo11DBException10addContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x33): undefined reference to `mongo::causedBy(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/cceJe78D.o: In function `mongo::UserException::UserException(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
tutorial.cpp:(.text._ZN5mongo13UserExceptionC2EiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN5mongo13UserExceptionC5EiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x2a): undefined reference to `vtable for mongo::UserException'
/tmp/cceJe78D.o: In function `mongo::UserException::~UserException()':
tutorial.cpp:(.text._ZN5mongo13UserExceptionD2Ev[_ZN5mongo13UserExceptionD5Ev]+0xd): undefined reference to `vtable for mongo::UserException'
/tmp/cceJe78D.o: In function `mongo::DBClientConnection::~DBClientConnection()':
tutorial.cpp:(.text._ZN5mongo18DBClientConnectionD2Ev[_ZN5mongo18DBClientConnectionD5Ev]+0xe): undefined reference to `vtable for mongo::DBClientConnection'
tutorial.cpp:(.text._ZN5mongo18DBClientConnectionD2Ev[_ZN5mongo18DBClientConnectionD5Ev]+0x1a): undefined reference to `vtable for mongo::DBClientConnection'
tutorial.cpp:(.text._ZN5mongo18DBClientConnectionD2Ev[_ZN5mongo18DBClientConnectionD5Ev]+0x2c): undefined reference to `mongo::DBClientConnection::_numConnections'
tutorial.cpp:(.text._ZN5mongo18DBClientConnectionD2Ev[_ZN5mongo18DBClientConnectionD5Ev]+0xbb): undefined reference to `mongo::DBClientBase::~DBClientBase()'
tutorial.cpp:(.text._ZN5mongo18DBClientConnectionD2Ev[_ZN5mongo18DBClientConnectionD5Ev]+0x189): undefined reference to `mongo::DBClientBase::~DBClientBase()'
/tmp/cceJe78D.o: In function `mongo::DBClientConnection::connect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
tutorial.cpp:(.text._ZN5mongo18DBClientConnection7connectERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN5mongo18DBClientConnection7connectERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x78): undefined reference to `mongo::HostAndPort::HostAndPort(mongo::StringData const&)'
/tmp/cceJe78D.o:(.gcc_except_table+0x50): undefined reference to `typeinfo for mongo::DBException'
/tmp/cceJe78D.o:(.rodata._ZTVN5mongo16ConnectExceptionE[_ZTVN5mongo16ConnectExceptionE]+0x30): undefined reference to `mongo::UserException::appendPrefix(std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >&) const'
/tmp/cceJe78D.o:(.rodata._ZTVN5mongo16ConnectExceptionE[_ZTVN5mongo16ConnectExceptionE]+0x40): undefined reference to `mongo::DBException::toString[abi:cxx11]() const'
/tmp/cceJe78D.o:(.rodata._ZTVN5mongo18AssertionExceptionE[_ZTVN5mongo18AssertionExceptionE]+0x40): undefined reference to `mongo::DBException::toString[abi:cxx11]() const'
/tmp/cceJe78D.o:(.rodata._ZTIN5mongo16ConnectExceptionE[_ZTIN5mongo16ConnectExceptionE]+0x10): undefined reference to `typeinfo for mongo::UserException'
/tmp/cceJe78D.o:(.rodata._ZTIN5mongo18AssertionExceptionE[_ZTIN5mongo18AssertionExceptionE]+0x10): undefined reference to `typeinfo for mongo::DBException'
collect2: error: ld returned 1 exit status
I've searched around Google, and saw some people with the same issue, but they didn't appear to be linking files correctly. As far as I can tell I'm doing everything correctly.
Any help would be greatly appreciated.
EDIT
Output if I change the command to:
g++ tutorial.cpp -I/opt/local/include -I/usr/include/boost -L/opt/local/lib -pthread -lmongoclient -lboost_thread -lboost_system -lboost_filesystem -lboost_program_options -o tutorial
/opt/local/lib/libmongoclient.a(dbclient.o): In function `boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::assign(char const*, char const*, unsigned int)':
/usr/include/boost/regex/v4/basic_regex.hpp:380: undefined reference to `boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)'
/opt/local/lib/libmongoclient.a(dbclient.o): In function `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::unwind_extra_block(bool)':
/usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp:1135: undefined reference to `boost::re_detail::put_mem_block(void*)'
/opt/local/lib/libmongoclient.a(dbclient.o): In function `boost::cpp_regex_traits<char>::transform_primary(char const*, char const*) const':
/usr/include/boost/regex/v4/cpp_regex_traits.hpp:965: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform_primary(char const*, char const*) const'
/opt/local/lib/libmongoclient.a(dbclient.o): In function `boost::cpp_regex_traits<char>::transform(char const*, char const*) const':
/usr/include/boost/regex/v4/cpp_regex_traits.hpp:961: undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform(char const*, char const*) const'
/opt/local/lib/libmongoclient.a(dbclient.o): In function `void boost::re_detail::raise_error<boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > >(boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::error_type)':
/usr/include/boost/regex/pattern_except.hpp:75: undefined reference to `boost::re_detail::raise_runtime_error(std::runtime_error const&)'
/opt/local/lib/libmongoclient.a(dbclient.o): In function `boost::re_detail::cpp_regex_traits_implementation<char>::error_string(boost::regex_constants::error_type) const':
/usr/include/boost/regex/v4/cpp_regex_traits.hpp:448: undefined reference to `boost::re_detail::get_default_error_string(boost::regex_constants::error_type)'
/opt/local/lib/libmongoclient.a(dbclient.o): In function `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::extend_stack()':
/usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp:213: undefined reference to `boost::re_detail::get_mem_block()'
/opt/local/lib/libmongoclient.a(dbclient.o): In function `boost::re_detail::save_state_init::save_state_init(boost::re_detail::saved_state**, boost::re_detail::saved_state**)':
/usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp:107: undefined reference to `boost::re_detail::get_mem_block()'
/opt/local/lib/libmongoclient.a(dbclient.o): In function `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match_imp()':
/usr/include/boost/regex/v4/perl_matcher_common.hpp:208: undefined reference to `boost::re_detail::verify_options(unsigned int, boost::regex_constants::_match_flags)'
/opt/local/lib/libmongoclient.a(dbclient.o): In function `boost::re_detail::save_state_init::~save_state_init()':
/usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp:115: undefined reference to `boost::re_detail::put_mem_block(void*)'
/opt/local/lib/libmongoclient.a(dbclient.o): In function `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match_prefix()':
/usr/include/boost/regex/v4/perl_matcher_common.hpp:333: undefined reference to `boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >::maybe_assign(boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > const&)'
/opt/local/lib/libmongoclient.a(dbclient.o): In function `boost::re_detail::save_state_init::~save_state_init()':
/usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp:115: undefined reference to `boost::re_detail::put_mem_block(void*)'
/opt/local/lib/libmongoclient.a(dbclient.o): In function `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::perl_matcher(__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >)':
/usr/include/boost/regex/v4/perl_matcher.hpp:365: undefined reference to `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)'
/opt/local/lib/libmongoclient.a(dbclient.o): In function `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match_match()':
/usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp:991: undefined reference to `boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >::maybe_assign(boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > const&)'
collect2: error: ld returned 1 exit status
In your g++ command, try to have tutorial.cpp first before the other libs. Some linkers needs to see the objects that need symbols first (from left to right)

boost:: signal library not working

Whenever I compile a program using boost::signal I get following errors:
/tmp/ccQFaJsy.o: In function `main':
b_vect.cpp:(.text+0xb7): undefined reference to `boost::signals::connection::~connection()'
/tmp/ccQFaJsy.o: In function `boost::signals::detail::slot_base::data_t::~data_t()':
b_vect.cpp:(.text._ZN5boost7signals6detail9slot_base6data_tD1Ev[boost::signals::detail::slot_base::data_t::~data_t()]+0x16): undefined reference to `boost::signals::connection::~connection()'
/tmp/ccQFaJsy.o: In function `boost::signal0<void, boost::last_value<void>, int, std::less<int>, boost::function0<void, std::allocator<boost::function_base> > >::signal0(boost::last_value<void> const&, std::less<int> const&)':
b_vect.cpp:(.text._ZN5boost7signal0IvNS_10last_valueIvEEiSt4lessIiENS_9function0IvSaINS_13function_baseEEEEEC1ERKS2_RKS4_[boost::signal0<void, boost::last_value<void>, int, std::less<int>, boost::function0<void, std::allocator<boost::function_base> > >::signal0(boost::last_value<void> const&, std::less<int> const&)]+0x51): undefined reference to `boost::signals::detail::signal_base::signal_base(boost::function2<bool, boost::signals::detail::stored_group, boost::signals::detail::stored_group, std::allocator<boost::function_base> > const&, boost::any const&)'
/tmp/ccQFaJsy.o: In function `boost::slot<boost::function0<void, std::allocator<boost::function_base> > >::slot<HelloWorld>(HelloWorld const&)':
b_vect.cpp:(.text._ZN5boost4slotINS_9function0IvSaINS_13function_baseEEEEEC1I10HelloWorldEERKT_[boost::slot<boost::function0<void, std::allocator<boost::function_base> > >::slot<HelloWorld>(HelloWorld const&)]+0xac): undefined reference to `boost::signals::detail::slot_base::create_connection()'
/tmp/ccQFaJsy.o: In function `boost::signal0<void, boost::last_value<void>, int, std::less<int>, boost::function0<void, std::allocator<boost::function_base> > >::connect(boost::slot<boost::function0<void, std::allocator<boost::function_base> > > const&, boost::signals::connect_position)':
b_vect.cpp:(.text._ZN5boost7signal0IvNS_10last_valueIvEEiSt4lessIiENS_9function0IvSaINS_13function_baseEEEEE7connectERKNS_4slotIS8_EENS_7signals16connect_positionE[boost::signal0<void, boost::last_value<void>, int, std::less<int>, boost::function0<void, std::allocator<boost::function_base> > >::connect(boost::slot<boost::function0<void, std::allocator<boost::function_base> > > const&, boost::signals::connect_position)]+0x9a): undefined reference to `boost::signals::detail::signal_base_impl::connect_slot(boost::any const&, boost::signals::detail::stored_group const&, boost::shared_ptr<boost::signals::detail::slot_base::data_t>, boost::signals::connect_position)'
/tmp/ccQFaJsy.o: In function `void boost::iterator_core_access::increment<boost::signals::detail::named_slot_map_iterator>(boost::signals::detail::named_slot_map_iterator&)':
b_vect.cpp:(.text._ZN5boost20iterator_core_access9incrementINS_7signals6detail23named_slot_map_iteratorEEEvRT_[void boost::iterator_core_access::increment<boost::signals::detail::named_slot_map_iterator>(boost::signals::detail::named_slot_map_iterator&)]+0x11): undefined reference to `boost::signals::detail::named_slot_map_iterator::increment()'
/tmp/ccQFaJsy.o: In function `bool boost::iterator_core_access::equal<boost::signals::detail::named_slot_map_iterator, boost::signals::detail::named_slot_map_iterator>(boost::signals::detail::named_slot_map_iterator const&, boost::signals::detail::named_slot_map_iterator const&, mpl_::bool_<true>)':
b_vect.cpp:(.text._ZN5boost20iterator_core_access5equalINS_7signals6detail23named_slot_map_iteratorES4_EEbRKT_RKT0_N4mpl_5bool_ILb1EEE[bool boost::iterator_core_access::equal<boost::signals::detail::named_slot_map_iterator, boost::signals::detail::named_slot_map_iterator>(boost::signals::detail::named_slot_map_iterator const&, boost::signals::detail::named_slot_map_iterator const&, mpl_::bool_<true>)]+0x19): undefined reference to `boost::signals::detail::named_slot_map_iterator::equal(boost::signals::detail::named_slot_map_iterator const&) const'
/tmp/ccQFaJsy.o: In function `boost::signals::detail::named_slot_map_iterator::reference boost::iterator_core_access::dereference<boost::signals::detail::named_slot_map_iterator>(boost::signals::detail::named_slot_map_iterator const&)':
b_vect.cpp:(.text._ZN5boost20iterator_core_access11dereferenceINS_7signals6detail23named_slot_map_iteratorEEENT_9referenceERKS5_[boost::signals::detail::named_slot_map_iterator::reference boost::iterator_core_access::dereference<boost::signals::detail::named_slot_map_iterator>(boost::signals::detail::named_slot_map_iterator const&)]+0x11): undefined reference to `boost::signals::detail::named_slot_map_iterator::dereference() const'
/tmp/ccQFaJsy.o: In function `boost::signals::detail::named_slot_map_iterator std::__find_if<boost::signals::detail::named_slot_map_iterator, boost::signals::detail::is_callable>(boost::signals::detail::named_slot_map_iterator, boost::signals::detail::named_slot_map_iterator, boost::signals::detail::is_callable, std::input_iterator_tag)':
b_vect.cpp:(.text._ZSt9__find_ifIN5boost7signals6detail23named_slot_map_iteratorENS2_11is_callableEET_S5_S5_T0_St18input_iterator_tag[boost::signals::detail::named_slot_map_iterator std::__find_if<boost::signals::detail::named_slot_map_iterator, boost::signals::detail::is_callable>(boost::signals::detail::named_slot_map_iterator, boost::signals::detail::named_slot_map_iterator, boost::signals::detail::is_callable, std::input_iterator_tag)]+0x6d): undefined reference to `boost::signals::detail::named_slot_map_iterator::named_slot_map_iterator(boost::signals::detail::named_slot_map_iterator const&)'
/tmp/ccQFaJsy.o: In function `boost::signals::detail::named_slot_map_iterator std::find_if<boost::signals::detail::named_slot_map_iterator, boost::signals::detail::is_callable>(boost::signals::detail::named_slot_map_iterator, boost::signals::detail::named_slot_map_iterator, boost::signals::detail::is_callable)':
b_vect.cpp:(.text._ZSt7find_ifIN5boost7signals6detail23named_slot_map_iteratorENS2_11is_callableEET_S5_S5_T0_[boost::signals::detail::named_slot_map_iterator std::find_if<boost::signals::detail::named_slot_map_iterator, boost::signals::detail::is_callable>(boost::signals::detail::named_slot_map_iterator, boost::signals::detail::named_slot_map_iterator, boost::signals::detail::is_callable)]+0x2b): undefined reference to `boost::signals::detail::named_slot_map_iterator::named_slot_map_iterator(boost::signals::detail::named_slot_map_iterator const&)'
b_vect.cpp:(.text._ZSt7find_ifIN5boost7signals6detail23named_slot_map_iteratorENS2_11is_callableEET_S5_S5_T0_[boost::signals::detail::named_slot_map_iterator std::find_if<boost::signals::detail::named_slot_map_iterator, boost::signals::detail::is_callable>(boost::signals::detail::named_slot_map_iterator, boost::signals::detail::named_slot_map_iterator, boost::signals::detail::is_callable)]+0x38): undefined reference to `boost::signals::detail::named_slot_map_iterator::named_slot_map_iterator(boost::signals::detail::named_slot_map_iterator const&)'
/tmp/ccQFaJsy.o: In function `boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator>::slot_call_iterator(boost::signals::detail::named_slot_map_iterator, boost::signals::detail::named_slot_map_iterator, boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::optional<boost::signals::detail::unusable>&)':
b_vect.cpp:(.text._ZN5boost7signals6detail18slot_call_iteratorINS1_11call_bound0IvE6callerINS_9function0IvSaINS_13function_baseEEEEEENS1_23named_slot_map_iteratorEEC1ESB_SB_SA_RNS_8optionalINS1_8unusableEEE[boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator>::slot_call_iterator(boost::signals::detail::named_slot_map_iterator, boost::signals::detail::named_slot_map_iterator, boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::optional<boost::signals::detail::unusable>&)]+0x34): undefined reference to `boost::signals::detail::named_slot_map_iterator::named_slot_map_iterator(boost::signals::detail::named_slot_map_iterator const&)'
b_vect.cpp:(.text._ZN5boost7signals6detail18slot_call_iteratorINS1_11call_bound0IvE6callerINS_9function0IvSaINS_13function_baseEEEEEENS1_23named_slot_map_iteratorEEC1ESB_SB_SA_RNS_8optionalINS1_8unusableEEE[boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator>::slot_call_iterator(boost::signals::detail::named_slot_map_iterator, boost::signals::detail::named_slot_map_iterator, boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::optional<boost::signals::detail::unusable>&)]+0x45): undefined reference to `boost::signals::detail::named_slot_map_iterator::named_slot_map_iterator(boost::signals::detail::named_slot_map_iterator const&)'
/tmp/ccQFaJsy.o:b_vect.cpp:(.text._ZN5boost7signals6detail18slot_call_iteratorINS1_11call_bound0IvE6callerINS_9function0IvSaINS_13function_baseEEEEEENS1_23named_slot_map_iteratorEEC1ESB_SB_SA_RNS_8optionalINS1_8unusableEEE[boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator>::slot_call_iterator(boost::signals::detail::named_slot_map_iterator, boost::signals::detail::named_slot_map_iterator, boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::optional<boost::signals::detail::unusable>&)]+0x71): more undefined references to `boost::signals::detail::named_slot_map_iterator::named_slot_map_iterator(boost::signals::detail::named_slot_map_iterator const&)' follow
/tmp/ccQFaJsy.o: In function `boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator>::slot_call_iterator(boost::signals::detail::named_slot_map_iterator, boost::signals::detail::named_slot_map_iterator, boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::optional<boost::signals::detail::unusable>&)':
b_vect.cpp:(.text._ZN5boost7signals6detail18slot_call_iteratorINS1_11call_bound0IvE6callerINS_9function0IvSaINS_13function_baseEEEEEENS1_23named_slot_map_iteratorEEC1ESB_SB_SA_RNS_8optionalINS1_8unusableEEE[boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator>::slot_call_iterator(boost::signals::detail::named_slot_map_iterator, boost::signals::detail::named_slot_map_iterator, boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::optional<boost::signals::detail::unusable>&)]+0xa6): undefined reference to `boost::signals::detail::named_slot_map_iterator::operator=(boost::signals::detail::named_slot_map_iterator const&)'
/tmp/ccQFaJsy.o: In function `boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator>::increment()':
b_vect.cpp:(.text._ZN5boost7signals6detail18slot_call_iteratorINS1_11call_bound0IvE6callerINS_9function0IvSaINS_13function_baseEEEEEENS1_23named_slot_map_iteratorEE9incrementEv[boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator>::increment()]+0x19): undefined reference to `boost::signals::detail::named_slot_map_iterator::named_slot_map_iterator(boost::signals::detail::named_slot_map_iterator const&)'
b_vect.cpp:(.text._ZN5boost7signals6detail18slot_call_iteratorINS1_11call_bound0IvE6callerINS_9function0IvSaINS_13function_baseEEEEEENS1_23named_slot_map_iteratorEE9incrementEv[boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator>::increment()]+0x31): undefined reference to `boost::signals::detail::named_slot_map_iterator::named_slot_map_iterator(boost::signals::detail::named_slot_map_iterator const&)'
b_vect.cpp:(.text._ZN5boost7signals6detail18slot_call_iteratorINS1_11call_bound0IvE6callerINS_9function0IvSaINS_13function_baseEEEEEENS1_23named_slot_map_iteratorEE9incrementEv[boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator>::increment()]+0x56): undefined reference to `boost::signals::detail::named_slot_map_iterator::operator=(boost::signals::detail::named_slot_map_iterator const&)'
/tmp/ccQFaJsy.o: In function `boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator>::equal(boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator> const&) const':
b_vect.cpp:(.text._ZNK5boost7signals6detail18slot_call_iteratorINS1_11call_bound0IvE6callerINS_9function0IvSaINS_13function_baseEEEEEENS1_23named_slot_map_iteratorEE5equalERKSC_[boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator>::equal(boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator> const&) const]+0x2c): undefined reference to `boost::signals::detail::named_slot_map_iterator::named_slot_map_iterator(boost::signals::detail::named_slot_map_iterator const&)'
b_vect.cpp:(.text._ZNK5boost7signals6detail18slot_call_iteratorINS1_11call_bound0IvE6callerINS_9function0IvSaINS_13function_baseEEEEEENS1_23named_slot_map_iteratorEE5equalERKSC_[boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator>::equal(boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator> const&) const]+0x3c): undefined reference to `boost::signals::detail::named_slot_map_iterator::named_slot_map_iterator(boost::signals::detail::named_slot_map_iterator const&)'
b_vect.cpp:(.text._ZNK5boost7signals6detail18slot_call_iteratorINS1_11call_bound0IvE6callerINS_9function0IvSaINS_13function_baseEEEEEENS1_23named_slot_map_iteratorEE5equalERKSC_[boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator>::equal(boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator> const&) const]+0x70): undefined reference to `boost::signals::detail::named_slot_map_iterator::operator=(boost::signals::detail::named_slot_map_iterator const&)'
b_vect.cpp:(.text._ZNK5boost7signals6detail18slot_call_iteratorINS1_11call_bound0IvE6callerINS_9function0IvSaINS_13function_baseEEEEEENS1_23named_slot_map_iteratorEE5equalERKSC_[boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator>::equal(boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator> const&) const]+0x84): undefined reference to `boost::signals::detail::named_slot_map_iterator::named_slot_map_iterator(boost::signals::detail::named_slot_map_iterator const&)'
b_vect.cpp:(.text._ZNK5boost7signals6detail18slot_call_iteratorINS1_11call_bound0IvE6callerINS_9function0IvSaINS_13function_baseEEEEEENS1_23named_slot_map_iteratorEE5equalERKSC_[boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator>::equal(boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator> const&) const]+0x94): undefined reference to `boost::signals::detail::named_slot_map_iterator::named_slot_map_iterator(boost::signals::detail::named_slot_map_iterator const&)'
b_vect.cpp:(.text._ZNK5boost7signals6detail18slot_call_iteratorINS1_11call_bound0IvE6callerINS_9function0IvSaINS_13function_baseEEEEEENS1_23named_slot_map_iteratorEE5equalERKSC_[boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator>::equal(boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound0<void>::caller<boost::function0<void, std::allocator<boost::function_base> > >, boost::signals::detail::named_slot_map_iterator> const&) const]+0xbf): undefined reference to `boost::signals::detail::named_slot_map_iterator::operator=(boost::signals::detail::named_slot_map_iterator const&)'
/tmp/ccQFaJsy.o: In function `boost::signal0<void, boost::last_value<void>, int, std::less<int>, boost::function0<void, std::allocator<boost::function_base> > >::operator()()':
b_vect.cpp:(.text._ZN5boost7signal0IvNS_10last_valueIvEEiSt4lessIiENS_9function0IvSaINS_13function_baseEEEEEclEv[boost::signal0<void, boost::last_value<void>, int, std::less<int>, boost::function0<void, std::allocator<boost::function_base> > >::operator()()]+0x22): undefined reference to `boost::signals::detail::call_notification::call_notification(boost::shared_ptr<boost::signals::detail::signal_base_impl> const&)'
b_vect.cpp:(.text._ZN5boost7signal0IvNS_10last_valueIvEEiSt4lessIiENS_9function0IvSaINS_13function_baseEEEEEclEv[boost::signal0<void, boost::last_value<void>, int, std::less<int>, boost::function0<void, std::allocator<boost::function_base> > >::operator()()]+0x69): undefined reference to `boost::signals::detail::named_slot_map::end()'
b_vect.cpp:(.text._ZN5boost7signal0IvNS_10last_valueIvEEiSt4lessIiENS_9function0IvSaINS_13function_baseEEEEEclEv[boost::signal0<void, boost::last_value<void>, int, std::less<int>, boost::function0<void, std::allocator<boost::function_base> > >::operator()()]+0x85): undefined reference to `boost::signals::detail::named_slot_map::end()'
b_vect.cpp:(.text._ZN5boost7signal0IvNS_10last_valueIvEEiSt4lessIiENS_9function0IvSaINS_13function_baseEEEEEclEv[boost::signal0<void, boost::last_value<void>, int, std::less<int>, boost::function0<void, std::allocator<boost::function_base> > >::operator()()]+0xc9): undefined reference to `boost::signals::detail::named_slot_map::end()'
b_vect.cpp:(.text._ZN5boost7signal0IvNS_10last_valueIvEEiSt4lessIiENS_9function0IvSaINS_13function_baseEEEEEclEv[boost::signal0<void, boost::last_value<void>, int, std::less<int>, boost::function0<void, std::allocator<boost::function_base> > >::operator()()]+0xe2): undefined reference to `boost::signals::detail::named_slot_map::begin()'
b_vect.cpp:(.text._ZN5boost7signal0IvNS_10last_valueIvEEiSt4lessIiENS_9function0IvSaINS_13function_baseEEEEEclEv[boost::signal0<void, boost::last_value<void>, int, std::less<int>, boost::function0<void, std::allocator<boost::function_base> > >::operator()()]+0x141): undefined reference to `boost::signals::detail::call_notification::~call_notification()'
b_vect.cpp:(.text._ZN5boost7signal0IvNS_10last_valueIvEEiSt4lessIiENS_9function0IvSaINS_13function_baseEEEEEclEv[boost::signal0<void, boost::last_value<void>, int, std::less<int>, boost::function0<void, std::allocator<boost::function_base> > >::operator()()]+0x184): undefined reference to `boost::signals::detail::call_notification::~call_notification()'
/tmp/ccQFaJsy.o: In function `boost::signal0<void, boost::last_value<void>, int, std::less<int>, boost::function0<void, std::allocator<boost::function_base> > >::~signal0()':
b_vect.cpp:(.text._ZN5boost7signal0IvNS_10last_valueIvEEiSt4lessIiENS_9function0IvSaINS_13function_baseEEEEED1Ev[boost::signal0<void, boost::last_value<void>, int, std::less<int>, boost::function0<void, std::allocator<boost::function_base> > >::~signal0()]+0x1a): undefined reference to `boost::signals::trackable::~trackable()'
b_vect.cpp:(.text._ZN5boost7signal0IvNS_10last_valueIvEEiSt4lessIiENS_9function0IvSaINS_13function_baseEEEEED1Ev[boost::signal0<void, boost::last_value<void>, int, std::less<int>, boost::function0<void, std::allocator<boost::function_base> > >::~signal0()]+0x2b): undefined reference to `boost::signals::detail::signal_base::~signal_base()'
b_vect.cpp:(.text._ZN5boost7signal0IvNS_10last_valueIvEEiSt4lessIiENS_9function0IvSaINS_13function_baseEEEEED1Ev[boost::signal0<void, boost::last_value<void>, int, std::less<int>, boost::function0<void, std::allocator<boost::function_base> > >::~signal0()]+0x46): undefined reference to `boost::signals::detail::signal_base::~signal_base()'
collect2: ld returned 1 exit status
Can someone help me please.
those are errors from the linker. so, the code compiles fine, and all the objetcs are produced, but the linker is telling you that you have used symbols (e.g., functions, class methods) which don't appear in any of the objects or files you're linking. so, you'll have to add the objects or libraries with those symbols to the list of files to be linked. the symbols you want may be in the boost binaries.
This may be a bit late for your answer. After seeing your code in the comments , i thing you are not calling the right library.
#include <boost/signals2.hpp>
#include <iostream>
void func1()
{
std::cout << "Hello world" << std::flush;
}
int main()
{
boost::signals2::signal<void ()> s;
s.connect(func1);
s();
}
you got to include signals2.hpp and not signals(though I am not very sure of it). This works just fine for me.