Xcode 7.3.1编译报错‘Unknown type name 'size_t'’,求助适配Mac OS X 10.11
Hey there, let's work through this frustrating error you're facing while building your app for El Capitan. I've dealt with similar issues targeting older macOS versions, so here are actionable steps to resolve the Unknown type name 'size_t' error:
Check required header includes
size_tis a standard C type defined in headers like<stddef.h>,<stdint.h>, or<stdlib.h>. The most common cause of this error is a missing include in the file where the error occurs. Start by adding#include <stddef.h>at the top of the problematic source file—this is often the quick fix.Verify Xcode SDK and command line tool configuration
Make sure your Xcode setup is properly aligned for El Capitan:- Open Xcode Preferences → Locations → Command Line Tools, and confirm it's set to Xcode 7.3.1.
- In your project's Build Settings, check that Base SDK is set to
OS X 10.11(not a newer SDK like Sierra or High Sierra). A mismatched SDK can break standard type definitions.
Audit custom preprocessor macros
Sometimes project-specific preprocessor macros can interfere with standard header parsing. Temporarily clear all custom macros in Build Settings → Preprocessor Macros, then recompile. If the error goes away, add your macros back one by one to identify which one is causing the conflict.Confirm C language standard setting
size_tis part of the C99 standard and later. In Build Settings → C Language Dialect, ensure you're usingGNU99,C99, or a newer standard. Avoid older standards likeC89, which don't includesize_tas a standard type.Clean project caches
Corrupted build caches can cause odd compilation errors. Try:- Using the shortcut
Cmd+Shift+Option+Kto clean the build folder. - Deleting the Derived Data folder (find its path in Xcode Preferences → Locations) and restarting Xcode before rebuilding.
- Using the shortcut
Since you're already compiling on El Capitan with the correct Xcode version (smart move for 10.11 compatibility!), focusing on these configuration and header issues should get you past this error.
内容的提问来源于stack exchange,提问作者Mike Crawford

