Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clang: symbols not found. cocos2d mac

When i compile my cocos2d mac project i get this error:

Undefined symbols for architecture x86_64:
"_inflateInit2_", referenced from:
  _ccInflateMemoryWithHint in ZipUtils.o
"_inflate", referenced from:
  _ccInflateMemoryWithHint in ZipUtils.o
"_inflateEnd", referenced from:
  _ccInflateMemoryWithHint in ZipUtils.o
"_gzopen", referenced from:
  _ccInflateGZipFile in ZipUtils.o
"_gzread", referenced from:
  _ccInflateGZipFile in ZipUtils.o
"_gzclose", referenced from:
  _ccInflateGZipFile in ZipUtils.o
"_uncompress", referenced from:
  _ccInflateCCZFile in ZipUtils.o

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
like image 592
JqueryToAddNumbers Avatar asked Jan 07 '12 07:01

JqueryToAddNumbers


2 Answers

You need to add the libz.dylib library to your target.

As of Xcode 4.6, this is very easy. The target summary screen lets you add and remove frameworks and libraries. Here's a demonstration:

adding a library to a target in Xcode 4.6 and later

like image 95
rob mayoff Avatar answered Nov 09 '22 10:11

rob mayoff


Open your target's Build Settings. Locate the Other Linker Flags setting. Add the -lz flag to it.

You don't need to add the libz.dylib as a framework as Rob suggests, although that works too.

like image 41
LearnCocos2D Avatar answered Nov 09 '22 10:11

LearnCocos2D