Reputation: 131
My build was working fine in xcode 15.4, after updating to 16.0, this problem is occurring. Could not find any reference for DarwinFoundation anywhere, any help or suggestion is welcome.
~/Sources/WireGuardKitC/WireGuardKitC.h:10:5 Declaration of 'u_int32_t' must be imported from module 'DarwinFoundation.unsigned_types.u_int32_t' before it is required
~/Sources/WireGuardKitC/WireGuardKitC.h:14:5 Declaration of 'u_char' must be imported from module 'DarwinFoundation.unsigned_types.u_char' before it is required
~/Sources/WireGuardKitC/WireGuardKitC.h:16:5 Declaration of 'u_int16_t' must be imported from module 'DarwinFoundation.unsigned_types.u_int16_t' before it is required
/// WireGuardKitC.h source ///
#include "key.h"
#include "x25519.h"
/* From <sys/kern_control.h> */
#define CTLIOCGINFO 0xc0644e03UL
struct ctl_info {
u_int32_t ctl_id;
char ctl_name[96];
};
struct sockaddr_ctl {
u_char sc_len;
u_char sc_family;
u_int16_t ss_sysaddr;
u_int32_t sc_id;
u_int32_t sc_unit;
u_int32_t sc_reserved[5];
};
problem was occurring in iOS projects for Wireguard implementation. It was working fine in Xcode 15.4, stopped working in 16.0.
Upvotes: 4
Views: 1033
Reputation: 1804
Simply add the following line at the top of the WireGuardKitC.h file:
#include <sys/types.h>
Here's a working example:
WireGuardKitC.h
#include <sys/types.h> // New line here
#include "key.h"
#include "x25519.h"
/* From <sys/kern_control.h> */
#define CTLIOCGINFO 0xc0644e03UL
struct ctl_info {
u_int32_t ctl_id;
char ctl_name[96];
};
struct sockaddr_ctl {
u_char sc_len;
u_char sc_family;
u_int16_t ss_sysaddr;
u_int32_t sc_id;
u_int32_t sc_unit;
u_int32_t sc_reserved[5];
};
Upvotes: 0
Reputation: 131
If anybody is still wandering, just adding
#import <Foundation/Foundation.h>
at top will fix the issue.
Upvotes: 6
Reputation: 1
Having the same issue I made the change to this
struct ctl_info {
int ctl_id;
char ctl_name[96];
};
struct sockaddr_ctl {
char sc_len;
char sc_family;
int ss_sysaddr;
int sc_id;
int sc_unit;
int sc_reserved[5];
};
hope that help you or at least the next person who gets here
Upvotes: 0