std:: 运行 项目错误,包括 OpenCV 或用 C/C++ 编写的库

std:: errors on running project including OpenCV or library written in C/C++

我正在构建一个测试目标并不断收到这些错误。我可以看到错误与 libstdc++ 中的 std 有关。根据我在网上发现的内容,如果我构建我在 libc++ 而不是 libstdc++ 中添加的框架,问题就会得到解决。问题是我最初已经以这种方式构建了它,但我仍然不断收到错误。

Ld  Library/Developer/Xcode/DerivedData/aokjgrqloka/Build/Products/Debug-iphonesimulator/Tests.xctest/Tests normal x86_64
    export IPHONEOS_DEPLOYMENT_TARGET=8.0
    export PATH="/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode-beta.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -bundle -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk -L Library/Developer/Xcode/DerivedData/aokjgrqloka/Build/Products/Debug-iphonesimulator -F Library/Developer/Xcode/DerivedData/aokjgrqloka/Build/Products/Debug-iphonesimulator -F /Framework -F/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -filelist  Library/Developer/Xcode/DerivedData/aokjgrqloka/Build/Intermediates/Project.build/Debug-iphonesimulator/Tests.build/Objects-normal/x86_64/Tests.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -mios-simulator-version-min=8.0 -Xlinker -object_path_lto -Xlinker  Library/Developer/Xcode/DerivedData/aokjgrqloka/Build/Intermediates/Project.build/Debug-iphonesimulator/Tests.build/Objects-normal/x86_64/Tests_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -framework XCTest -framework opencv2 -lProject -Xlinker -dependency_info -Xlinker  Library/Developer/Xcode/DerivedData/aokjgrqloka/Build/Intermediates/Project.build/Debug-iphonesimulator/Tests.build/Objects-normal/x86_64/Tests_dependency_info.dat -o  Library/Developer/Xcode/DerivedData/aokjgrqloka/Build/Products/Debug-iphonesimulator/Tests.xctest/Tests

Undefined symbols for architecture x86_64:
  "std::runtime_error::what() const", referenced from:
      vtable for cvflann::FLANNException in opencv2(miniflann.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(char const*) const", referenced from:
      cv::DescriptorMatcher::create(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in opencv2(matchers.o)
      cv::FeatureDetector::create(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in opencv2(detectors.o)
      cv::AdjusterAdapter::create(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in opencv2(dynamic.o)
  "std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
      ...
  "std::__1::__vector_base_common<true>::__throw_out_of_range() const", referenced from:
      cv::BriskScaleSpace::getKeypoints(int, std::__1::vector<cv::KeyPoint, std::__1::allocator<cv::KeyPoint> >&) in opencv2(brisk.o)
      cv::FREAK::buildPattern() in opencv2(freak.o)
  "std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
      std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str() const in opencv2(miniflann.o)
      ...
      ...
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::assign(char const*)", referenced from:
      cv::tempfile(char const*) in opencv2(system.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::resize(unsigned long, char)", referenced from:
      icvClose(CvFileStorage*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) in opencv2(persistence.o)
      std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in opencv2(miniflann.o)
      std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::overflow(int) in opencv2(miniflann.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::reserve(unsigned long)", referenced from:
      cv::FileStorage::releaseAndGetString() in opencv2(persistence.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::push_back(char)", referenced from:
      std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::overflow(int) in opencv2(miniflann.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      cv::operator<<(cv::FileStorage&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in opencv2(persistence.o)
      cv::Exception::Exception(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) in opencv2(system.o)
      cv::tempfile(char const*) in opencv2(system.o)
      cv::error(cv::Exception const&) in opencv2(system.o)
      cv::FlannBasedMatcher::read(cv::FileNode const&) in opencv2(matchers.o)
      cv::GlFont::GlFont(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, cv::GlFont::Weight, cv::GlFont::Style) in opencv2(opengl_interop_deprecated.o)
      cv::flann::IndexParams::getString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in opencv2(miniflann.o)
      ...
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      cv::operator<<(cv::FileStorage&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in opencv2(persistence.o)
      cv::Exception::formatMessage() in opencv2(system.o)
      cv::FlannBasedMatcher::read(cv::FileNode const&) in opencv2(matchers.o)
      cv::gpu::DeviceInfo::query() in opencv2(gpumat.o)
      cvflann::anyimpl::big_any_policy<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::move(void* const*, void**) in opencv2(miniflann.o)
      std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in opencv2(miniflann.o)
      cv::Param::Param(int, bool, int, int (cv::Algorithm::*)() const, void (cv::Algorithm::*)(int), std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) i  
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::sync()", referenced from:
      vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in opencv2(miniflann.o)
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::imbue(std::__1::locale const&)", referenced from:
      vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in opencv2(miniflann.o)
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::uflow()", referenced from:
      vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in opencv2(miniflann.o)
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::setbuf(char*, long)", referenced from:
      vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in opencv2(miniflann.o)
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::xsgetn(char*, long)", referenced from:
      vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in opencv2(miniflann.o)
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::xsputn(char const*, long)", referenced from:
      vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in opencv2(miniflann.o)
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::showmanyc()", referenced from:
      vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in opencv2(miniflann.o)
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::basic_streambuf()", referenced from:
      cvflann::lsh::LshTable<unsigned char>::initialize(unsigned long) in opencv2(miniflann.o)
      cvflann::AutotunedIndex<cvflann::L2<float> >::buildIndex() in opencv2(miniflann.o)
      cvflann::AutotunedIndex<cvflann::L1<float> >::buildIndex() in opencv2(miniflann.o)
  "std::__1::basic_streambuf<char, std::__1::char_traits<char> >::~basic_streambuf()", referenced from:
      cvflann::lsh::LshTable<unsigned char>::initialize(unsigned long) in opencv2(miniflann.o)
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in opencv2(miniflann.o)
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in opencv2(miniflann.o)
      non-virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in opencv2(miniflann.o)
      non-virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in opencv2(miniflann.o)
      virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in opencv2(miniflann.o)
      virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in opencv2(miniflann.o)
      ...
  "std::__1::cerr", referenced from:
      cv::gpu::error(char const*, char const*, int, char const*) in opencv2(gpumat.o)
      cvflann::lsh::LshTable<float>::LshTable(unsigned int, unsigned int, std::__1::vector<unsigned long, std::__1::allocator<unsigned long> >&) in opencv2(miniflann.o)
      cvflann::lsh::LshTable<float>::getKey(float const*) const in opencv2(miniflann.o)
  "std::__1::cout", referenced from:
      ...
      ...
  "void std::__1::__sort<std::__1::__less<double, double>&, double*>(double*, double*, std::__1::__less<double, double>&)", referenced from:
      cv::SimpleBlobDetector::findBlobs(cv::Mat const&, cv::Mat const&, std::__1::vector<cv::SimpleBlobDetector::Center, std::__1::allocator<cv::SimpleBlobDetector::Center> >&) const in opencv2(blobdetector.o)
  "void std::__1::__sort<std::__1::__less<int, int>&, int*>(int*, int*, std::__1::__less<int, int>&)", referenced from:
      cvflann::HierarchicalClusteringIndex<cvflann::HammingLUT2>::computeClustering(cvflann::HierarchicalClusteringIndex<cvflann::HammingLUT2>::Node*, int*, int, int, int) in opencv2(miniflann.o)
      cvflann::KMeansIndex<cvflann::L2<float> >::computeClustering(cvflann::KMeansIndex<cvflann::L2<float> >::KMeansNode*, int*, int, int, int) in opencv2(miniflann.o)
      cvflann::HierarchicalClusteringIndex<cvflann::L2<float> >::computeClustering(cvflann::HierarchicalClusteringIndex<cvflann::L2<float> >::Node*, int*, int, int, int) in opencv2(miniflann.o)
      cvflann::KMeansIndex<cvflann::L1<float> >::computeClustering(cvflann::KMeansIndex<cvflann::L1<float> >::KMeansNode*, int*, int, int, int) in opencv2(miniflann.o)
      cvflann::HierarchicalClusteringIndex<cvflann::L1<float> >::computeClustering(cvflann::HierarchicalClusteringIndex<cvflann::L1<float> >::Node*, int*, int, int, int) in opencv2(miniflann.o)
      ...
  "std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > >::id", referenced from:
      ...
  "std::__1::__rs_get()", referenced from:
      void std::__1::random_shuffle<std::__1::__wrap_iter<int*> >(std::__1::__wrap_iter<int*>, std::__1::__wrap_iter<int*>) in opencv2(miniflann.o)
      void std::__1::random_shuffle<std::__1::__wrap_iter<unsigned long*> >(std::__1::__wrap_iter<unsigned long*>, std::__1::__wrap_iter<unsigned long*>) in opencv2(miniflann.o)
  "std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:

      ...
  "std::__1::ios_base::init(void*)", referenced from:
      cvflann::lsh::LshTable<unsigned char>::initialize(unsigned long) in opencv2(miniflann.o)
      cvflann::AutotunedIndex<cvflann::L2<float> >::buildIndex() in opencv2(miniflann.o)
      cvflann::AutotunedIndex<cvflann::L1<float> >::buildIndex() in opencv2(miniflann.o)
  "std::__1::ios_base::clear(unsigned int)", referenced from:

      ...
  "std::__1::basic_ios<char, std::__1::char_traits<char> >::~basic_ios()", referenced from:
      cvflann::lsh::LshTable<unsigned char>::initialize(unsigned long) in opencv2(miniflann.o)
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in opencv2(miniflann.o)
      std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in opencv2(miniflann.o)
      non-virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in opencv2(miniflann.o)
      non-virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in opencv2(miniflann.o)
      virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in opencv2(miniflann.o)
      virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in opencv2(miniflann.o)
      ...
  "std::exception::~exception()", referenced from:
      cv::Exception::Exception(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) in opencv2(system.o)
      cv::Exception::~Exception() in opencv2(system.o)
      cv::error(cv::Exception const&) in opencv2(system.o)
  "std::uncaught_exception()", referenced from:
      cv::gpu::error(char const*, char const*, int, char const*) in opencv2(gpumat.o)
  "std::terminate()", referenced from:
      ___clang_call_terminate in opencv2(stat.o)
      ___clang_call_terminate in opencv2(persistence.o)
      ___clang_call_terminate in opencv2(matrix.o)
      ...
  "typeinfo for unsigned char", referenced from:
      cv::flann::IndexParams::getAll(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&, std::__1::vector<int, std::__1::allocator<int> >&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&, std::__1::vector<double, std::__1::allocator<double> >&) const in opencv2(miniflann.o)
  "typeinfo for int", referenced from:
      cv::flann::IndexParams::getInt(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) const in opencv2(miniflann.o)
      cv::flann::IndexParams::getAll(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&, std::__1::vector<int, std::__1::allocator<int> >&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&, std::__1::vector<double, std::__1::allocator<double> >&) const in opencv2(miniflann.o)
      cvflann::anyimpl::typed_base_any_policy<int>::type() in opencv2(miniflann.o)
      cvflann::HierarchicalClusteringIndex<cvflann::HammingLUT2>::HierarchicalClusteringIndex(cvflann::Matrix<unsigned char> const&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, cvflann::any, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, cvflann::any> > > const&, cvflann::HammingLUT2) in opencv2(miniflann.o)
      cvflann::HierarchicalClusteringIndex<cvflann::HammingLUT2>::findNeighbors(cvflann::ResultSet<int>&, unsigned char const*, cvflann::SearchParams const&) in opencv2(miniflann.o)
      cvflann::LshIndex<cvflann::HammingLUT2>::LshIndex(cvflann::Matrix<unsigned char> const&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, cvflann::any, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, cvflann::any> > > const&, cvflann::HammingLUT2) in opencv2(miniflann.o)
      cvflann::KDTreeSingleIndex<cvflann::L2<float> >::KDTreeSingleIndex(cvflann::Matrix<float> const&, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, cvflann::any, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, cvflann::any> > > const&, cvflann::L2<float>) in opencv2(miniflann.o)
      ...
  "vtable for __cxxabiv1::__enum_type_info", referenced from:
      typeinfo for cvflann::flann_algorithm_t in opencv2(miniflann.o)
      typeinfo for cvflann::flann_centers_init_t in opencv2(miniflann.o)
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for __cxxabiv1::__class_type_info", referenced from:
      typeinfo for cv::FileStorage in opencv2(persistence.o)
      typeinfo for cv::_InputArray in opencv2(matrix.o)
      typeinfo for cv::TLSDataContainer in opencv2(system.o)
      typeinfo for cv::MatOp in opencv2(matop.o)
      typeinfo for cv::ParallelLoopBody in opencv2(parallel.o)
      typeinfo for cv::DescriptorMatcher::DescriptorCollection in opencv2(matchers.o)
      ...
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for __cxxabiv1::__pointer_type_info", referenced from:
      typeinfo for cvflann::KDTreeIndex<cvflann::L2<float> >::Node* in opencv2(miniflann.o)
      typeinfo for cvflann::KDTreeIndex<cvflann::L2<float> >::Node** in opencv2(miniflann.o)
      typeinfo for cvflann::KDTreeIndex<cvflann::L1<float> >::Node* in opencv2(miniflann.o)
      typeinfo for cvflann::KDTreeIndex<cvflann::L1<float> >::Node** in opencv2(miniflann.o)
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for __cxxabiv1::__si_class_type_info", referenced from:
      typeinfo for cv::BatchDistInvoker in opencv2(stat.o)
      typeinfo for cv::_OutputArray in opencv2(matrix.o)
      typeinfo for cv::KMeansPPDistanceComputer in opencv2(matrix.o)
      typeinfo for cv::KMeansDistanceComputer in opencv2(matrix.o)
      typeinfo for cv::Exception in opencv2(system.o)
      typeinfo for cv::resizeNNInvoker in opencv2(imgwarp.o)
      typeinfo for cv::RemapInvoker in opencv2(imgwarp.o)
      ...
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for __cxxabiv1::__vmi_class_type_info", referenced from:
      typeinfo for cv::Feature2D in opencv2(orb.o)
      typeinfo for cv::Feature2D in opencv2(surf.o)
      typeinfo for cv::FeatureDetector in opencv2(detectors.o)
      typeinfo for cv::DescriptorExtractor in opencv2(descriptors.o)
      typeinfo for std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > in opencv2(miniflann.o)
      typeinfo for cv::Feature2D in opencv2(features2d_init.o)
      typeinfo for cv::Feature2D in opencv2(sift.o)
      ...
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for std::out_of_range", referenced from:
      cv::FREAK::computeImpl(cv::Mat const&, std::__1::vector<cv::KeyPoint, std::__1::allocator<cv::KeyPoint> >&, cv::Mat&) const in opencv2(freak.o)

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

好的,所以我仍然不太清楚为什么即使在使用 libC++ 构建 OpenCV 时问题仍然存在。解决我的问题的解决方法是将 libstdc++.tbd 添加到我的目标框架。

您尝试将 libstdc++ 与针对 libc++ 构建的 OpenCV 版本一起使用,并且您需要 link 针对构建 OpenCV 的相同标准库。