Let me fix that for you: Xcode 5 linker error for static libraries

My previously fine project suddenly didn’t build anymore. Xcode failed to link static libraries, because it was trying to link them as executables. Fortunately that was quite apparent in the error messages for undefined symbols, such as:

"_compress", referenced from:
dami::io::CompressedWriter::flush() in io_decorators.o
"_main", referenced from:
implicit entry/start for main executable

As it turns out, my xcconfig file contained an empty value for the target’s binary type (key “MACH_O_TYPE”). I guess previously Xcode inferred the binary type by looking at the extension, if this value was not set. The correct line is below, but you can also find the setting in the project editor in Xcode.

MACH_O_TYPE = mh_execute

Leave a comment

Your comment