Adding C file causes pch error

I have an XCode project with objective-C files. If I add a new (empty) C file and try to build, I immediately get a lot of errors when creating a precompiled header in the ProcessPCH step. Mistakes are a โ€œfatal error: it is not possible to create the Foundation module, but things were not found in Foundation.h . Delete the C file and it will be created again. What is happening and how to fix it?

(Xcode 5.0, OSX 10.8.4)

EDIT I โ€‹โ€‹tried the Clean and Clean build folder, with no effect.

Setting EDIT Precompile prefix header = No results in a bunch of syntax errors, for example, in NSObject.h tags (and another Foundation Foundation header).

EDIT User Cy-4AH realized this: the whole pch file should have #ifdef __OBJC__ .

+6
source share
1 answer

Surround #import with preprocessor directive #ifdef __OBJC__ #endif

+18
source

Source: https://habr.com/ru/post/957172/


All Articles