I am trying to compile an existing project with Xcode 15 RC, the project uses some dependencies that internally use zlib
.
zlib.h
is included using
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ZLIB_H
#include "zlib.h"
#endif
...
I get this error: Import of C++ module 'zlib' appears within extern "C" language linkage specification
Everything was working fine on Xcode 14. Is zlib
a c++ library now?
I can move the includes out of the extern "C"
scope, but my I have POD dependencies failing and I don't have control over them, I can try using cocoapods-patch
but I wonder if there is an easier way to solve this problem.
extern "C" {
is a C++ feature that is invalid in C and further code in that block is expected to be C.
zlib.h has own extern "C" {
, and when you include zlib.h in extern "C" {
you get nested extern "C" {
and the compiler warns you about that: C++ code is met where C code is expected.
Don't include zlib.h in extern "C" {
block, move the last after all inclusions.