opencv2.framework在macox10.10报错

来源:互联网 发布:尖锐湿疹多少钱知乎 编辑:程序博客网 时间:2024/06/05 07:46

报错:

Undefined symbols for architecture armv7s:

  "_jpeg_free_small", referenced from:

      _free_pool in opencv2(jmemmgr.o)

      _self_destruct in opencv2(jmemmgr.o)

  "_jpeg_mem_available", referenced from:

      _realize_virt_arrays in opencv2(jmemmgr.o)

  "_jpeg_free_large", referenced from:

      _free_pool in opencv2(jmemmgr.o)

  "_jpeg_open_backing_store", referenced from:

      _realize_virt_arrays in opencv2(jmemmgr.o)

  "_jpeg_get_large", referenced from:

      _alloc_large in opencv2(jmemmgr.o)

      _realize_virt_arrays in opencv2(jmemmgr.o)

  "_jpeg_mem_term", referenced from:

      _jinit_memory_mgr in opencv2(jmemmgr.o)

      _self_destruct in opencv2(jmemmgr.o)

  "_jpeg_mem_init", referenced from:

      _jinit_memory_mgr in opencv2(jmemmgr.o)

  "_jpeg_get_small", referenced from:

      _jinit_memory_mgr in opencv2(jmemmgr.o)

      _alloc_small in opencv2(jmemmgr.o)

ld: symbol(s) not found for architecture armv7s

clang: error: linker command failed with exit code 1 (use -v to see invocation)



解决方法:

So here's a little workaround. The problem is because the XCode project is unable to link to the libjpeg.a library. So thats why you get the above errors when you compile the project.

Follow these steps :

1. Go to : [[http://sourceforge.net/projects/libjpeg-turbo/files/1.4.0/]] and download the libjpeg-turbo-1.4.0.dmg (3.8 MB) file.
2. Install the package. Once its done you will find the installed files under this path : /opt/libjpeg-turbo/lib
3. Open up your terminal and type the following command : lipo -info /opt/libjpeg-turbo/lib/libjpeg.a
4. If the terminal shows the following the output after running the command then it means, you can use the library for your iOS project(armv7/armv7s) * Architectures in the fat file: /opt/libjpeg-turbo/lib/libturbojpeg.a are: i386 x86_64 armv6 armv7 armv7s arm64* 
5. Use finder to navigate to : /opt/libjpeg-turbo/lib and copy libjpeg.a and place it in your project folder.
6. Head over to your XCode project -> Click on Project Name -> Targets -> General -> Linked frameworks and libraries -> Click on the add button placed at the bottom -> include the libjpeg.a file
7. Compile the project. It shouldn't show any more linker errors.




0 0
原创粉丝点击