0

I have an application that uses mongoose as a library. After updating Xcode to 13.1 (macOS Monterey) I am getting a compile error that I can't figure out how to fix:

type 'struct ah' has incompatible definitions in different translation units

This is in a block of code within mongoose where a struct is being defined and used:

// Parsed Authorization header
struct ah {
  char *user, *uri, *cnonce, *response, *qop, *nc, *nonce;
};

// Return 1 on success. Always initializes the ah structure.
static int parse_auth_header(struct mg_connection *conn, char *buf,
                             size_t buf_size, struct ah *ah) {
  char *name, *value, *s;
  const char *auth_header;

  (void) memset(ah, 0, sizeof(*ah));
  if ((auth_header = mg_get_header(conn, "Authorization")) == NULL ||
      mg_strncasecmp(auth_header, "Digest ", 7) != 0) {
    return 0;
  }

I would really rather not modify the code since it's a 3rd party library that may receive updates. But at the same time I have to be able to build my app.

Is there an Xcode setting that I'm not seeing to get around this? I'm not sure what the error even means.

spartygw
  • 3,289
  • 2
  • 27
  • 51

1 Answers1

0

For anyone having problems with this in 2022 and who don't want or can't rename their structs:

I have found this post on a Chinese blog: https://www.cnblogs.com/dzqdzq/p/9977638.html

Basically, the easy fix seems to be to disable the "Enable Modules (C and Objective-C)" build setting. It seems disabling this option makes the XCode Clang compiler work in a way that is more similar to GCC.

enter image description here