Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error building Static Library with OpenCV and Xcode on C++

I'm trying to build a DLL library for Unity3D (in 32-bit) but first of all I want to make a .a static library to make a C++ Wrapper for C#.

Well, this is what I've done.

  • I've built OpenCV unchecking BUILD_SHARED_LIBS in order to get the STATIC LIBS, with architecture i386.
  • I've made my static library code and built it, Linking the static libraries that I needed (I really import them all because I'm having errors and I want to know if it's an error lib-based), (included from /lib/ and /3rdparty/lib/).
  • I'm linking my library and header in a new project (Command Line Tool) in order to test my new static library, but my errors are:

Undefined symbols for architecture i386: "_gzclose", referenced from: icvClose(CvFileStorage, std::__1::basic_string<char, std::__1::char_traits<char="">, std::__1::allocator<char> >) in libeyeslibrary.a(persistence.cpp.o) _cvOpenFileStorage in libeyeslibrary.a(persistence.cpp.o) "_gzeof", referenced from: icvYMLSkipSpaces(CvFileStorage, char, int, int) in libeyeslibrary.a(persistence.cpp.o) icvXMLSkipSpaces(CvFileStorage, char, int) in libeyeslibrary.a(persistence.cpp.o) "_gzgets", referenced from: icvGets(CvFileStorage, char, int) in libeyeslibrary.a(persistence.cpp.o) "_gzopen", referenced from: _cvOpenFileStorage in libeyeslibrary.a(persistence.cpp.o) "_gzputs", referenced from: icvPuts(CvFileStorage, char const) in libeyeslibrary.a(persistence.cpp.o) "_gzrewind", referenced from: _cvOpenFileStorage in libeyeslibrary.a(persistence.cpp.o) ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Well, I have no idea what's wrong. Does anyone have idea about this?

Thank you very much in advance.

Regards.