Xcode 6.1 Precompiled Headers - xcode6

In Xcode 6.1, creating a new project does not create a precompiled header file using the single view iOS project template. If I add one manually, any definitions in the pch file are not available in any other source files.
I've looked at many threads and questions and tried cleaning, re-buiding, re-starting, deleting derived data and manually removing the CACHE_ROOT/SharedPrecompileHeaders folder. All to no avail, though.
Some info suggests ticking to include in targets, but this is disabled for pch and other header files now.
See comment below.

Have you tried adding the path of the pch file?
Go to your project -> Build Settings -> Apple LLVM 6.0 Language.
Under it, set the following things:
Precompile Prefix Header: Set it to YES
Prefix Header: Set the path to the pch file
Update 2018/09/23: In Xcode10 it is under Apple Clang - Language

Related

bridging header problem compiling project on Mac mini despite compiling and running perfectly on macBookPro

I am running this project on my MBP and works fine , upon pulling from the repo or even copying the entire project to my Mac mini the errors in the image happen .
I am sure it works (verified adding the bridging header correctly and setting the appropriate flags in the build settings for the target as it works on the MBP)
my project is in swift , the library to import is written in objective c and I am running Xcode 9.4.1 on both machines
any help is appreciated
edit :
- I tried uninstalling and reinstalling macOS and Xcode and the error still persisted
- error msgs : "/Users/******/Desktop/folderName/folderName/Bridging-Header.h:9:9: error: 'PayFortSDK/PayFortSDK.h' file not found
import
^
1 error generated.
:0: error: failed to emit precompiled header '/Users/******/Library/Developer/Xcode/DerivedData/projectName-hjvpkqxmenpclmebdbrkxcarqoap/Build/Intermediates.noindex/PrecompiledHeaders/Bridging-Header-swift_27LSG8YDJOKNN-clang_13WCR1S0OL464.pch' for bridging header '/Users/******/Desktop/folderName/folderName/Bridging-Header.h'"
EDIT : found solution :
1- deleted framework files and old bridging header
2- added new bridging header with a new name and modified the name in buildSettings
3- added framework files again under Frameworks
4- some files had different targets(main target - testing targets) / unified all files targets
5-clean/ index / build Succedded
SecondEDIT : ** another branch / same project **
there was another bridging header is the project folder that was not added to the project after deleting it everything worked as expected
check your build settings, there is your bridging header path is set or not and then also clean your derivedData Folder,then clean and run your project

How to properly add System Header Search Paths in Xcode

I'm having a problem getting the 'System Header Search Paths' in build settings to work in Xcode and allow me to use #import <Core/CoreBlocks.h> rather than a local copy and #import "CoreBlocks.h"
First I need to "frame" the problem.
I have built a framework that I use across many if not all my projects. This is Core.framework . Inside the framework is the requisite "Headers" directory and within that 40 other headers, all of which are included in the 41'st header Core.h
I drop the Core.framework into another project and the other project headers or source files then import:
#import <Core/Core.h>
and get all the functionality of the 40 modules in the framework. Works fine.
BUT, what I need is a simple way to run the 40 modules of Core.framework outside the framework construct, as a separate build or project, with just the source and breakpoints, so I can debug and enhance it.
I try to define the framework's source directory as a search path for the other project:
yet the compiler complains about the inability to find the headers in the source code:
is all I get for all of the imports even though they all reside in the lower Core directory below that path:
~/Development/Projects/Core/Core/Core/NSRange+Core.h
And that's where I'm at a loss. What am I doing wrong?
Found out why... Xcode for some reason can't use the *nix home directory notation in a pathname.
In other words while:
~/Development/Projects/Core/Core
does not work, the expanded equivalent:
/Users/BC/Development/Projects/Core/Core
does work in the Xcode system header search paths, yet it is not obvious as to why...

What should I do if I can't find the GPUImage.h header for the GPUImage framework?

I have created a sample application to perform bump distortion, using the GPUImage framework. I added this framework to my application, but I'm seeing the following error
Lexical or preprocessor issue 'GPUImage.h' file not found.
I have added the -ObjC flag to the Other Linker Flags, but I'm still seeing this error. How can I solve this problem and get my application to compile?
Adding GPUImage framework to XCode project could be tricky. So I haved added detailed step-by-step instructions w/ images on how to do it.
Static Compilation Method (detailed solution so we don't mess up)
This is Static compilation method. In this basically we will compile the framework using ./build.sh file. And simply add it to our XCode project, then configure XCode to properly use it.
Download GPUImage from Github and extract it (or just clone it).
Go to the GPUImagefolder in terminal
Run ./build.sh
Note: This will compile and create ready-to-use binary for all the sdks on your mac.
build.sh creates a folder called build and generates compiled binaries and dumps them to folders like: Release-iPhone, Release-iPhoneOS, Release-iphonesimulator etc folders.
For iPhone use Release-iphone (This also works for simulator).
Copy (not drag-drop) Release-iphone to your XCode project's root directory so that we have a local copy of framework.
Now iPhone drag-and-drop Release-iphone onto your XCode project. Make sure to check "Copy to .." option.
Note:
This Release-iphone folder contains two sub-folders: include and lib
include folder contains all the header .h files
lib folder contains compiled binary version file called libGPUImage.a
We now need to simply configure XCode to use .h and .a files.**
Select your project in the project explorer > Project name under Targets > select Build Phases > Expand Link Binary With Libraries
Add the libGPUImage.a to Link Binary With Libraries section. You may want to Right-click on libGPUImage.a then Open in Finder and finally drag-drop it.
While we are at it, also add the following GPUImage's dependent frameworks/ libraries
CoreMedia, CoreVideo, OpenGLES, AVFoundation, QuartzCore to Link Binary With Libraries section
Now, lets configure .h headers.
Select your project in the project explorer > Project name under Targets > select Build Settings > and type search paths to see search paths section.
Open Headers Search Paths by clicking on the value field.
Drag-and-drop the lib folder to that popup. Note: If it shows absolute path, change it to looks $(SRCROOT)/path/to/lib/. (You should have the framework relative to your xcode project see step 6).
Repeat 11 & 12 for Library Search Paths as well.
Additional tips: You can add .h files to Library Search Paths or Headers Search Paths, you can make them Recursive. I have a main root-folder called Dependencies folder where I keep all the dependencies like MySDK-framework including Release-iPhone. And I just have one search-path at the Dependencies (root folder) and made it recursive.
Did you follow all of the instructions from the Readme on the project page? From the installation instructions:
You'll also need to find the framework headers, so within your
project's build settings set the Header Search Paths to the relative
path from your application to the framework/ subdirectory within the
GPUImage source directory. Make this header search path recursive.
If you're seeing the above error, it means that you did not point the Header Search Paths at the right directory where you've installed GPUImage relative to your project, and / or did not click the checkbox to the left to make those search paths recursive.
I show some screenshots of where you need to go to set this in this answer, which explains something similar for the Core Plot framework. The same principles apply, only you need to find where you installed the GPUImage framework at.
I add relative path to "Header Search Paths", but there is still a error that is "not found".
Then, I add path to "User Header Search Paths", and it works.
May help you.
finally, I realized the KEY WORD is relativeļ¼
I put GPUImage source files in my project root dir:
before I solved the problem, I add Header Search Paths is:
$(PROJECT_DIR)/GPUImage/framework
$(PROJECT_DIR)/GPUImage/framework/iOS
and make them Recursive, but error is still there, So I changed Paths to:
GPUImage/framework and make it Recursive, then it works.
Hope it helps.

three20 and xcode4.3 : lexical or preprocessor issue file not found

I am using Xcode 4.3 and iOS 5.1.
I have add three20 to my project successfully. but I encounter 2 issues:
1- ld: warning: directory not found for option '-L/Projects/iphone/myProj/three20/Build/Products/Debug-iphoneos
2- file not found when I import "Three20/TTStyleSheet.h" and other header file
I have added these
$(BUILT_PRODUCTS_DIR)/../three20
$(BUILT_PRODUCTS_DIR)/../../three20
three20/Build/Products/three20
to header search paths as well.
I am using Xcode 4.3 and iOS 5.1.
any suggestion to fix theses 2 issues.
thanks
Edit : warning was coursed by Library Search Paths which used to mention three20/Build/Products/Debug-iphoneos by deleting that I have no warning. But I still have the error
I have figure out it was a stupid mistake that I did and import directly header files (like "Three20/TTStyleSheet.h" ) to my classes instead of importing "Three20/three20.h"
Also, TTStyleSheet.h is within a folder called Three20Style. So you must do:
#import 'Three20Style/TTStyleSheet.h'
if you want only that header file to be included.

Xcode - how to include c library and header file to cocoa project?

How do I add c library to Xcode Cocoa project?
Or what is the best option, I don't want to copy them into Cocoa project directory.
I have a C project called a which compiles into library a.dylib and header file a.h, the project is located in it's own directory.
I want to use this library from my objective-c application in Xcode.
How do I add the header file and library to my Xcode project?
I can drag the a.dylib into other frameworks but what do I do with a.h?
I figured it out.
I point to location of project a deployment directory (headers) to Search Path in project settings either:
as Header Search Paths, if used as <a/a.h>
or into User Header Search Paths, if used as "a/a.h"
As for library I just drag it to Xcode project and set it to refer to library instead of copy.
Here are the steps before adding a header file test.h in your project. Here is the files location root -> Library -> include -> test.h
click on build settings
Find User Header Search path. add your header file location here. add following value to Debug, Release and Any Architecture field. $(SRCROOT)/Library/include. Your project Root is the folder that contains your project, it conatins .xcodeproj file.
After adding path you will be able to add header in like this
# include "test.h"
You can drag them both the .a and .h files to Xcode, but make sure to not check the "Copy items to project folder". As for referencing the header file, you'll need to put it in a place where you can add a path to it in your #include/#import statements. Is there a reason you don't want to copy the header to your project file?