编译使用Opencv的cpp文件

时间:2012-07-14 17:07:48

标签: c++ opencv

所以我有一个使用OpenCV的.cpp文件。我在链接库方面遇到了一些问题,但我认为我的Makefile现在“更好”了。

生成文件:

CC=g++
#CC=gcc

# compile flags
CFLAGS=-g -Wall

# OpenCV Related
prefix=/usr/local/opencv

OCVFLAGS=-I${prefix}/include/opencv -I${prefix}/include
OCVLIBS=-L${prefix}/lib -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_flann -lopencv_objdetect -lopencv_calib3d


PROGRAM=extractDescriptorsToFile

OBJECTS=$(PROGRAM).o

program: $(OBJECTS)
    $(CC) $(OBJECTS) -o $(PROGRAM) $(OCVLIBS) -arch i386 

$(PROGRAM).o: $(PROGRAM).cpp
    $(CC) -c $(CFLAGS) $(OCVFLAGS) $(PROGRAM).cpp 

clean:
    rm -f *o
    rm -f $(PROGRAM)
    rm -f *~

然而,当我“make”时,会生成.o文件但是我收到此错误:

ld: warning: ignoring file extractDescriptorsToFile.o, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
  "_main", referenced from:
      start in crt1.10.6.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
make: *** [program] Error 1

这是一篇类似的帖子“Precompiled headers and compiling universal objects on OSX”,但我认为这不是我的问题吗?

任何帮助将不胜感激......?

我认为这个错误有时是由于没有main()但我的文件确实...

删除“-arch i386”让我:

Undefined symbols for architecture x86_64:
  "cv::operator<<(cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      cv::operator<<(cv::FileStorage&, char const*)in extractDescriptorsToFile.o
      extract(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, char**, cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in extractDescriptorsToFile.o
      _main in extractDescriptorsToFile.o
  "cv::Ptr<CvFileStorage>::delete_obj()", referenced from:
      cv::Ptr<CvFileStorage>::release()      in extractDescriptorsToFile.o
  "cv::fastFree(void*)", referenced from:
      cv::Ptr<CvFileStorage>::release()      in extractDescriptorsToFile.o
      cv::Ptr<cv::FeatureDetector>::release()      in extractDescriptorsToFile.o
      cv::Ptr<cv::DescriptorExtractor>::release()      in extractDescriptorsToFile.o
      cv::Mat::~Mat() in extractDescriptorsToFile.o
  "cv::fastMalloc(unsigned long)", referenced from:
      cv::Ptr<cv::FeatureDetector>::Ptr(cv::FeatureDetector*)in extractDescriptorsToFile.o
  "cv::Mat::deallocate()", referenced from:
      cv::Mat::release()    in extractDescriptorsToFile.o
  "cv::Mat::copySize(cv::Mat const&)", referenced from:
      cv::Mat::operator=(cv::Mat const&)in extractDescriptorsToFile.o
  "cv::Exception::Exception(int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)", referenced from:
      cv::FileStorage& cv::operator<< <cv::Mat>(cv::FileStorage&, cv::Mat const&)in extractDescriptorsToFile.o
  "cv::error(cv::Exception const&)", referenced from:
      cv::FileStorage& cv::operator<< <cv::Mat>(cv::FileStorage&, cv::Mat const&)in extractDescriptorsToFile.o
  "cv::Exception::~Exception()", referenced from:
      cv::FileStorage& cv::operator<< <cv::Mat>(cv::FileStorage&, cv::Mat const&)in extractDescriptorsToFile.o
  "cv::write(cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::Mat const&)", referenced from:
      cv::FileStorage& cv::operator<< <cv::Mat>(cv::FileStorage&, cv::Mat const&)in extractDescriptorsToFile.o
  "cv::_OutputArray::_OutputArray(cv::Mat&)", referenced from:
      resizeImage(cv::Mat const&, int)in extractDescriptorsToFile.o
  "cv::_InputArray::_InputArray(cv::Mat const&)", referenced from:
      resizeImage(cv::Mat const&, int)in extractDescriptorsToFile.o
  "cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)", referenced from:
      resizeImage(cv::Mat const&, int)in extractDescriptorsToFile.o
  "cv::OrbFeatureDetector::OrbFeatureDetector(unsigned long, cv::ORB::CommonParams)", referenced from:
      extract(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, char**, cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in extractDescriptorsToFile.o
  "cv::FeatureDetector::create(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      extract(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, char**, cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in extractDescriptorsToFile.o
  "cv::DescriptorExtractor::create(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      extract(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, char**, cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in extractDescriptorsToFile.o
  "cv::imread(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)", referenced from:
      extract(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, char**, cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in extractDescriptorsToFile.o
  "cv::FeatureDetector::detect(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat const&) const", referenced from:
      extract(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, char**, cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in extractDescriptorsToFile.o
  "cv::DescriptorExtractor::compute(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const", referenced from:
      extract(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, char**, cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in extractDescriptorsToFile.o
  "cv::write(cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> > const&)", referenced from:
      extract(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, char**, cv::FileStorage&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in extractDescriptorsToFile.o
  "cv::FileStorage::FileStorage()", referenced from:
      _main in extractDescriptorsToFile.o
  "cv::FileStorage::FileStorage(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      _main in extractDescriptorsToFile.o
  "cv::FileStorage::~FileStorage()", referenced from:
      _main in extractDescriptorsToFile.o
  "cv::FileStorage::isOpened() const", referenced from:
      _main in extractDescriptorsToFile.o
  "cv::FileStorage::release()", referenced from:
      _main in extractDescriptorsToFile.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [program] Error 1

这是我在向program$(PROGRAM).o添加-archi时所获得的:

Undefined symbols for architecture i386:
  "_gzputs", referenced from:
      icvPuts(CvFileStorage*, char const*)in libopencv_core.a(persistence.o)
  "_gzgets", referenced from:
      icvGets(CvFileStorage*, char*, int)in libopencv_core.a(persistence.o)
  "_gzeof", referenced from:
      icvEof(CvFileStorage*)      in libopencv_core.a(persistence.o)
  "_gzclose", referenced from:
      _cvReleaseFileStorage in libopencv_core.a(persistence.o)
      _cvOpenFileStorage in libopencv_core.a(persistence.o)
  "_gzopen", referenced from:
      _cvOpenFileStorage in libopencv_core.a(persistence.o)
  "_gzrewind", referenced from:
      _cvOpenFileStorage in libopencv_core.a(persistence.o)
  "cv::Mat::convertTo(cv::Mat&, int, double, double) const", referenced from:
      cv::imencode(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::Mat const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(loadsave.o)
      cv::imwrite_(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::Mat const&, std::vector<int, std::allocator<int> > const&, bool)in libopencv_highgui.a(loadsave.o)
  "cv::flip(cv::Mat const&, cv::Mat&, int)", referenced from:
      _cvEncodeImage in libopencv_highgui.a(loadsave.o)
      cv::imwrite_(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::Mat const&, std::vector<int, std::allocator<int> > const&, bool)in libopencv_highgui.a(loadsave.o)
  "_jpeg_destroy_decompress", referenced from:
      cv::JpegDecoder::close()     in libopencv_highgui.a(grfmt_jpeg.o)
      cv::JpegDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_jpeg.o)
      cv::JpegDecoder::readHeader()      in libopencv_highgui.a(grfmt_jpeg.o)
      cv::JpegDecoder::~JpegDecoder()in libopencv_highgui.a(grfmt_jpeg.o)
      cv::JpegDecoder::~JpegDecoder()in libopencv_highgui.a(grfmt_jpeg.o)
      cv::JpegDecoder::~JpegDecoder()in libopencv_highgui.a(grfmt_jpeg.o)
  "_jpeg_CreateCompress", referenced from:
      cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
  "_jpeg_std_error", referenced from:
      cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
      cv::JpegDecoder::readHeader()      in libopencv_highgui.a(grfmt_jpeg.o)
  "_jpeg_destroy_compress", referenced from:
      cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
  "_jpeg_set_defaults", referenced from:
      cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
  "_jpeg_set_quality", referenced from:
      cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
  "_jpeg_start_compress", referenced from:
      cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
  "_jpeg_write_scanlines", referenced from:
      cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
  "_jpeg_finish_compress", referenced from:
      cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
  "_jpeg_stdio_dest", referenced from:
      cv::JpegEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg.o)
  "_jpeg_start_decompress", referenced from:
      cv::JpegDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_jpeg.o)
  "_jpeg_read_scanlines", referenced from:
      cv::JpegDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_jpeg.o)
  "_jpeg_finish_decompress", referenced from:
      cv::JpegDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_jpeg.o)
  "_jpeg_alloc_huff_table", referenced from:
      cv::JpegDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_jpeg.o)
  "_jpeg_CreateDecompress", referenced from:
      cv::JpegDecoder::readHeader()      in libopencv_highgui.a(grfmt_jpeg.o)
  "_jpeg_read_header", referenced from:
      cv::JpegDecoder::readHeader()      in libopencv_highgui.a(grfmt_jpeg.o)
  "_jpeg_stdio_src", referenced from:
      cv::JpegDecoder::readHeader()      in libopencv_highgui.a(grfmt_jpeg.o)
  "_jpeg_resync_to_restart", referenced from:
      cv::jpeg_buffer_src(jpeg_decompress_struct*, cv::JpegSource*)       in libopencv_highgui.a(grfmt_jpeg.o)
      cv::JpegDecoder::readHeader()      in libopencv_highgui.a(grfmt_jpeg.o)
  "_jas_init", referenced from:
      __static_initialization_and_destruction_0(int, int)in libopencv_highgui.a(grfmt_jpeg2000.o)
  "_jas_cleanup", referenced from:
      ___tcf_0 in libopencv_highgui.a(grfmt_jpeg2000.o)
  "_jas_matrix_create", referenced from:
      cv::Jpeg2KEncoder::writeComponent16u(void*, cv::Mat const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
      cv::Jpeg2KEncoder::writeComponent8u(void*, cv::Mat const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
      cv::Jpeg2KDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_jpeg2000.o)
  "_jas_image_writecmpt", referenced from:
      cv::Jpeg2KEncoder::writeComponent16u(void*, cv::Mat const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
      cv::Jpeg2KEncoder::writeComponent8u(void*, cv::Mat const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
  "_jas_matrix_destroy", referenced from:
      cv::Jpeg2KEncoder::writeComponent16u(void*, cv::Mat const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
      cv::Jpeg2KEncoder::writeComponent8u(void*, cv::Mat const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
      cv::Jpeg2KDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_jpeg2000.o)
  "_jas_stream_close", referenced from:
      cv::Jpeg2KDecoder::close()     in libopencv_highgui.a(grfmt_jpeg2000.o)
      cv::Jpeg2KEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
      cv::Jpeg2KDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_jpeg2000.o)
      cv::Jpeg2KDecoder::readHeader()      in libopencv_highgui.a(grfmt_jpeg2000.o)
  "_jas_image_destroy", referenced from:
      cv::Jpeg2KDecoder::close()     in libopencv_highgui.a(grfmt_jpeg2000.o)
      cv::Jpeg2KEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
      cv::Jpeg2KDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_jpeg2000.o)
      cv::Jpeg2KDecoder::readHeader()      in libopencv_highgui.a(grfmt_jpeg2000.o)
  "_jas_image_create", referenced from:
      cv::Jpeg2KEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
  "_jas_stream_fopen", referenced from:
      cv::Jpeg2KEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
      cv::Jpeg2KDecoder::readHeader()      in libopencv_highgui.a(grfmt_jpeg2000.o)
  "_jas_image_strtofmt", referenced from:
      cv::Jpeg2KEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
  "_jas_image_encode", referenced from:
      cv::Jpeg2KEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_jpeg2000.o)
  "_jas_image_getcmptbytype", referenced from:
      cv::Jpeg2KDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_jpeg2000.o)
  "_jas_cmprof_createfromclrspc", referenced from:
      cv::Jpeg2KDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_jpeg2000.o)
  "_jas_image_chclrspc", referenced from:
      cv::Jpeg2KDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_jpeg2000.o)
  "_jas_cmprof_destroy", referenced from:
      cv::Jpeg2KDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_jpeg2000.o)
  "_jas_image_readcmpt", referenced from:
      cv::Jpeg2KDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_jpeg2000.o)
  "_jas_image_decode", referenced from:
      cv::Jpeg2KDecoder::readHeader()      in libopencv_highgui.a(grfmt_jpeg2000.o)
  "_png_destroy_read_struct", referenced from:
      cv::PngDecoder::close()     in libopencv_highgui.a(grfmt_png.o)
      cv::PngDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_png.o)
      cv::PngDecoder::readHeader()      in libopencv_highgui.a(grfmt_png.o)
      cv::PngDecoder::~PngDecoder()in libopencv_highgui.a(grfmt_png.o)
      cv::PngDecoder::~PngDecoder()in libopencv_highgui.a(grfmt_png.o)
      cv::PngDecoder::~PngDecoder()in libopencv_highgui.a(grfmt_png.o)
  "_png_create_write_struct", referenced from:
      cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
  "_png_create_info_struct", referenced from:
      cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
      cv::PngDecoder::readHeader()      in libopencv_highgui.a(grfmt_png.o)
  "_png_destroy_write_struct", referenced from:
      cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
  "_png_set_write_fn", referenced from:
      cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
  "_png_set_filter", referenced from:
      cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
  "_png_set_compression_level", referenced from:
      cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
  "_png_set_compression_strategy", referenced from:
      cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
  "_png_set_IHDR", referenced from:
      cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
  "_png_write_info", referenced from:
      cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
  "_png_set_bgr", referenced from:
      cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
      cv::PngDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_png.o)
  "_png_write_image", referenced from:
      cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
  "_png_write_end", referenced from:
      cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
  "_png_set_compression_mem_level", referenced from:
      cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
  "_png_init_io", referenced from:
      cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
      cv::PngDecoder::readHeader()      in libopencv_highgui.a(grfmt_png.o)
  "_png_set_swap", referenced from:
      cv::PngEncoder::write(cv::Mat const&, std::vector<int, std::allocator<int> > const&)in libopencv_highgui.a(grfmt_png.o)
      cv::PngDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_png.o)
  "_png_set_strip_alpha", referenced from:
      cv::PngDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_png.o)
  "_png_read_update_info", referenced from:
      cv::PngDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_png.o)
  "_png_read_image", referenced from:
      cv::PngDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_png.o)
  "_png_read_end", referenced from:
      cv::PngDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_png.o)
  "_png_set_rgb_to_gray", referenced from:
      cv::PngDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_png.o)
  "_png_set_gray_to_rgb", referenced from:
      cv::PngDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_png.o)
  "_png_set_expand_gray_1_2_4_to_8", referenced from:
      cv::PngDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_png.o)
  "_png_set_palette_to_rgb", referenced from:
      cv::PngDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_png.o)
  "_png_set_strip_16", referenced from:
      cv::PngDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_png.o)
  "_png_create_read_struct", referenced from:
      cv::PngDecoder::readHeader()      in libopencv_highgui.a(grfmt_png.o)
  "_png_set_read_fn", referenced from:
      cv::PngDecoder::readHeader()      in libopencv_highgui.a(grfmt_png.o)
  "_png_read_info", referenced from:
      cv::PngDecoder::readHeader()      in libopencv_highgui.a(grfmt_png.o)
  "_png_get_IHDR", referenced from:
      cv::PngDecoder::readHeader()      in libopencv_highgui.a(grfmt_png.o)
  "_png_error", referenced from:
      cv::PngDecoder::readDataFromBuf(void*, unsigned char*, unsigned long)in libopencv_highgui.a(grfmt_png.o)
  "_TIFFClose", referenced from:
      cv::TiffDecoder::close()     in libopencv_highgui.a(grfmt_tiff.o)
      cv::TiffDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_tiff.o)
      cv::TiffDecoder::readHeader()      in libopencv_highgui.a(grfmt_tiff.o)
      cv::TiffDecoder::~TiffDecoder()in libopencv_highgui.a(grfmt_tiff.o)
      cv::TiffDecoder::~TiffDecoder()in libopencv_highgui.a(grfmt_tiff.o)
      cv::TiffDecoder::~TiffDecoder()in libopencv_highgui.a(grfmt_tiff.o)
  "_TIFFIsTiled", referenced from:
      cv::TiffDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_tiff.o)
  "_TIFFGetField", referenced from:
      cv::TiffDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_tiff.o)
      cv::TiffDecoder::readHeader()      in libopencv_highgui.a(grfmt_tiff.o)
  "_TIFFReadEncodedStrip", referenced from:
      cv::TiffDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_tiff.o)
  "_TIFFReadRGBAStrip", referenced from:
      cv::TiffDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_tiff.o)
  "_TIFFReadEncodedTile", referenced from:
      cv::TiffDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_tiff.o)
  "_TIFFReadRGBATile", referenced from:
      cv::TiffDecoder::readData(cv::Mat&)     in libopencv_highgui.a(grfmt_tiff.o)
  "_TIFFOpen", referenced from:
      cv::TiffDecoder::readHeader()      in libopencv_highgui.a(grfmt_tiff.o)
  "_TIFFRGBAImageOK", referenced from:
      cv::TiffDecoder::readHeader()      in libopencv_highgui.a(grfmt_tiff.o)
  "_TIFFSetErrorHandler", referenced from:
      cv::TiffDecoder::TiffDecoder()in libopencv_highgui.a(grfmt_tiff.o)
      cv::TiffDecoder::TiffDecoder()in libopencv_highgui.a(grfmt_tiff.o)
  "_TIFFSetWarningHandler", referenced from:
      cv::TiffDecoder::TiffDecoder()in libopencv_highgui.a(grfmt_tiff.o)
      cv::TiffDecoder::TiffDecoder()in libopencv_highgui.a(grfmt_tiff.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
make: *** [program] Error 1

1 个答案:

答案 0 :(得分:0)

如果从第19行删除显式体系结构规范(“-arch i386”)会发生什么?我想这可能会有所帮助。

修改

在我看来,你有一个64位操作系统和32位OpenCV库。