How can I add a header folder to my project? - objective-c

I'm developing an iOS application with latest Xcode 4.5.2.
I have the following folder structure:
/.../SourceCode/MyProjectFolder/projectName.xcodeproject
/.../SourceCode/MyProjectFolder/projectName/
/.../SourceCode/MyProjectFolder/projectName/xxx.m
/.../SourceCode/MyProjectFolder/projectName/xxx.h
/.../SourceCode/MyProjectFolder/projectName/PVRT/
/.../SourceCode/MyProjectFolder/projectName/PVRT/header1.h
/.../SourceCode/MyProjectFolder/projectName/PVRT/OtherFolder/header2.h
If in my header files I add this:
#include "header1.h"
I get a "header1.h" not found error.
But, if I add:
#include "PVRT/header1.h"
I get a "header2.h" not found.
On project settings I have add the following path:
${SOURCE_ROOT}/projectName/PVRT
But I'm getting the same error.
How can I fix this?

Adjust "Header Search Path" values in build settings of target & set according to your project's header file paths.
Hope it may solve your problem.

In the 'Build settings' of your target, search for 'Header Search Paths'. In the highest field (so before 'Debug' and 'Release') type in the following line:
"$(SRCROOT)"/**
This will add your entire source directory to the header search path. You can always expand the path if you want to include specific folders.

Related

Can't find ProjectName-swift.h

It works for one target but not the other. I have looked at build settings to see where this file is set but I can't find it.
#import "Wunder-Swift.h"
This gets me the error "file not found". I have no idea where to set this.
Wunder-Swift.h file can be found in Target -> Build Settings -> Objective-c Bridging Header.
Or you can search for "swift", it will show you.
If Wunder-Swift.h is not added in your project then just add a new Objective-C file, it will show an option to add a Bridging-Header file and automatically set your bridge file path.

Xcode 6 beta build fails after moving -Bridging-Header objective-c swift xcode6

I am facing build fail error after moving Bridging-Header
objective-c swift on xcode6.
Before I moved header file, it had been working fine.
The error shows header file not exist. The header file path remains still old path in error log. I tried build clean, but still old path remains.
How can clean the objc-header-path?
You need to update the path in your project's Build Settings to point to the new bridging header location.
Click your target and then click 'Build Settings' then search for Objective-C Bridging Header
You'll find the path to the bridging header in your target's Build Settings, under "Swift Compiler - Code Generation"/"Objective C Bridging Header".
I tried with Xcode6.1-Beta, as well.
But still impossible to update the objective-c header path.
I don't know where the configuration file is. I gave up to figure out.
Finally, I deleted the target xcode project and recreated new project.
Now it is working.
Yes it's possible.
Delete the .h file
Clear the path at Objective-C Bridging Header
Create new Objective-C File
Name your header file to the same name as before (popup will ask you to create new header file)
Goto File > Project Settings > Data Location
Make sure your path is correct and press "Done"
Your app should run again pointing to the right location of the header file and delete the files ModuleCache
Happens to me many times when i move app folder around.
I had a workspace that I was using when I had the same thing happen. I moved my project to a different folder. Despite having a relative path on my bridge headers, it was still referencing the old location when building and threw an error.
Here's what I did to fix this:
Close the workspace
Open the .xcworkspace file using TextWrangler. TextWrangler allowed me to navigate the package to /xcuserdata/[username].xcuserdatad/UserInterfaceState.xcuserstate. I did a search for the old path and found it. Make the change to the new location of the header file.
This by itself didn't fix it. After cleaning and building, the old value showed back up! Then I deleted the Build folder. It has a ModuleCache that I think was holding on to the old value as well.
After doing this, my project picked up my new value and I was able to build the project. I'm not certain step 2 is necessary. But it did store the old value in there.
In my case, I changed the path from relative path to absolute path and solved.
like
From:
project_name/project_name-Bridging-Header.h
To:
$(SRCROOT)/project_name/project_name-Bridging-Header.h

regarding - Xcode error-> Clang: error: no input files

I am totally new to the Xcode and getting the error below:
clang: error: no such file or directory:
'/usersd/chairman/desktop/MySecondTabApp/MySecondTabbApp/"MySecondTabbApp/MySecondTabbApp-Prefix.pch"'
Clang: error: no input files
Command/Users/chairman/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/user/bin/clang
failed with exit code 1
Did you move your folder/files after making the project? It's because Xcode can't find the prefix header for some reason. It can be easily fixed by relocating it.
Change the Prefix Header to where the .pch file is located in your folder.
Select your project and go to Build Phases and search go through whole list under "Compile Sources". If some files are red then delete those files by pressing - button at the bottom. Also make sure these files are in the list without red color.
Make new file: ⌘cmd+N iOS/Mac > Other > PCH File >
YourProject-Prefix.pch. Project > Build Settings > Search:
"Prefix Header". Under "Apple LLVM 6.0" you will get the Prefix
Header key. Type in: "YourProjectName/YourProject-Prefix.pch"
Clean project: ⌘cmd+⇧shift+K Build project: ⌘cmd+B
please go to Prefix header file
Target> Build Settings > Prefix Header.
then copy paste this line & change Your Project name
$(SRCROOT)/Your_Project_name-Prefix.pch
Its working you 100% gurantee.
Had the same problem. Try replacing MySecondTabbApp/MySecondTabbApp-Prefix.pch with MySecondTabbApp-Prefix.pch.
Had same problem. Had to go into Finder (outside of Xcode) and place my .pch file in a new folder to match the requested path.
Once the file's location matched the path it was fixed.
Comment Quoted from another site was the issue is resolved for me
hmm that's strange. Try this - click on the name of your project on the list of files/folders on the left in Xcode (at the very top of the list). Look at the "Targets" section on the left-hand side of the window to the right. Likely, there's two listed with the second being a "test" item. Right-click on that item and select "delete". Then try to run the project again. See screenshot below for a visual cue.
enter image description here
updating the pods helped me
pod update
It turned out to be a dependency issue. Updating the pod installed necessary components
clang: error: no such file or directory: '/usersd/chairman/desktop/MySecondTabApp/MySecondTabbApp/"MySecondTabbApp/MySecondTabbApp-Prefix.pch"'
It means your Pch file does not exists in above path. Check in you code where PCH file is available and and take that path and upload in PrefixHeader in Apple LLVM 8.0. Like
$(SRCROOT)/PATH/app_PrefixHeader.pch

Header file not found

I have a project, which has a static library with references to header files like this:
#import <libetpan/libetpan.h>
I can't change this import line. What should I do, to make Xcode find those header files? I have a folder with header files, that I can import to the project. Thanks.
At the moment the error is following:
'libetpan/libetpan.h' file not found
You may have added the libetpan folder to your project (if not, do so)
right click on that folder and see the path (get info after right click)
if its not a sibling of your project file in the folder structure (check in finder), thats where its going wrong
alternately, you could add header search paths: header search path in XCode 4

Lexical or Preprocesssor issue in xcode

i'm working on one zip and unzip module, i have uploaded all files into my folder,
but its still showing that
#include "minizip/zip.h"
#include "minizip/unzip.h"
These files are missing... with the error Lexical or Preprocesssor issue..
Can any one please help in this issue.
Thanks in advance.
Make sure that you have the minizip directory added to your project hierarchy. The easiest way is to just drag the minizip folder from the Finder to your project window.
Did you add the header path to: "User Header Search Paths" to search your headers in Build Settings?