2012-07-14 68 views
3

所以我有一個使用OpenCV的.cpp文件。我在鏈接庫時遇到了一些問題,但我認爲我的Makefile現在「更好」了。編譯一個使用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 *~ 

然而,當我 「作」,生成的.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 

這是我得到當我添加-arch i386的雙方program$(PROGRAM).o

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

dI在OSX上沒有使用make,但是你真的需要'-arch i386'嗎?嘗試擺脫它,並建立它 – 2012-07-14 17:16:24

+1

在終端文件extractDescriptorsToFile.o'的輸出是什麼?如何將'-arch i386'選項添加到'$(PROGRAM).o'而不是'program'? – 2012-07-14 17:39:53

+0

如果我將選項添加到'$(PROGRAM).o' INSTEAD OF'program',我將刪除'-arch i386'時得到的所有錯誤顯示在我的答案中。所以我增加了這個選項,並且沒有改變。 'extractDescriptorToFile.o'的輸出是'extractDescriptorsToFile.o:Mach-O 64位對象x86_64'。 – user1135469 2012-07-14 17:50:14

回答

0

,如果你從19行刪除明確的體系結構規範( 「-arch I386」)會發生什麼?我想這可能會有所幫助。

編輯

嗯,在我看來,你有一個64位操作系統和32位OpenCV的庫。

+0

我只放了「-arch i386」來擺脫一些其他的錯誤和警告。我編輯了我的問題以顯示這些錯誤。 – user1135469 2012-07-14 17:26:29

+0

爲了清楚起見,當你將'-arch i386'添加到**''program'和'$(PROGRAM).o'目標時,你到底得到了什麼? – taketwo 2012-07-14 18:17:23

+0

我編輯了我的問題以顯示發生了什麼。它讓我相信我對圖書館有問題或者將它們聯繫起來......也許? – user1135469 2012-07-14 18:29:33