#include <inttypes.h> from C library.

I have a library written in C. In the header file it contains #include <inttypes.h>. Library is imported from C++ code as

extern "C" {
#include <lib.h>
}

After update to Xcode 15.3 i can't use it because it complains on:

Import of C++ module 'std_inttypes_h' appears within extern "C" language linkage specification

As I understand inttypes.h is a header from both worlds C and C++ and it could be used in .c code or inside of headers for that code.

What would you suggest? I don't want to change library from one side nor disable module validation. It's a valid case and it should compile without an error.

  • Adding this link https://en.cppreference.com/w/cpp/header as a note to myself.

Add a Comment

Replies

What happens if you #include it without the extern “C” block?