Cannot access folder path header file in solution - iphone

I imported one project to another project by following this link tutorial
successfully build that two project. But when I added
#import <SampleSubproject/SampleSubproject.h> this to my main ViewController.m file error be occur.
Error : "SampleSubproject/SampleSubproject.h" file is not found.
Why is that error occurred ??
Is there any error ?
Please help me guys!

You have Headers search path settings at project configuration. Let's say there're directories A and B. With "SampleSubproject/SampleSubproject.h" Xcode looks for SampleSubproject.h at A/SampleSubproject/SampleSubproject.h and B/SampleSubproject/SampleSubproject.h. If there's a checked recursive flag for any directories, the search is performed at this directories and their subdirectories.
Now you'll need to check what is the headers search path for the target you are building keeping in mind that you might have several targets and the file with the import might not be included into all the targets.
As you also have a red library, you'll want to check the Libraries search path as well, it works in the same way.

Related

lexical or preprocessor issue file not found occurs while archiving?

I am new to this iPhone development and i have almost completed my first application but when i try for creating an archive it gives an error lexical or preprocessed issue file not found But it runs fine in simulator and also has also tested on device. I have included SDwebimage architecture for lazy loading of image in table view.Can any tell me what is the issue?
Few things to try, Ensure the Framework and all it's headers are imported into your project properly.
Also in your Build Settings set YES to Always search user paths, and make sure your User header paths are pointing to the Framework.
Finally, Build->Clean and Restart Xcode.
Hope this helps !
UPDATE: According to SDWebImage's installation, it's required you make a modification to Header Search Path and not User header paths, As seen below.
Have you done this as well? I suggest slowly, re-doing all the installation steps from the beginning.
Spaces in a folder name in your header search path can cause this problem. Make sure the folders in your project do not have spaces in their names.
My project was building fine until I updated to Xcode 10.1. After the Xcode update, started getting Lexical or preprocessor Issue errors on build. Some XCDataModel header files could not be found.
This fixed the issue.
Go to Build Settings, Header Search Paths
Change the appropriate value from $(SRCROOT) non-recursive to recursive.
This ensures that subfolders are also searched for headers during build.
I had this same issue now and found that my sub-projects 'Public Header Folder Path' was set to an incorrect path (when compared with what my main project was using as its 'Header Search Path' and 'User Header Search Path').
e.g.
My main project had the following:
Header Search Paths
Debug "build/Debug-iphoneos/../../Headers"
Release "build/Debug-iphoneos/../../Headers"
And the same for the User Header Search Paths
Whereas my sub-project (dependency) had the following:
Public Header Folder Path
Debug "include/BoxSDK"
Release "include/BoxSDK"
Changing the 'Public Header Folder Path' to "../../Headers/BoxSDK" fixed the problem since the main project was already searching that folder ('../../Headers').
PS: I took some good screenshots, but I am not allowed to post an answer with images until I hit reputation 10 :(
I had this problem after changed project name. I used all the methods mentioned on the internet but still doesn't work. Then I realized that all the header files not found was from cocoapods, so I re-installed the cocoapods using pod install, and thus solved the problem.
Hope this could help.
In my case I was developing a framework and had a test application inside it, what was missing is inside the test application target -> build settings -> Framework Search Paths:
The value needed to be the framework path (the build output - .framework) which is in my case:
"../FrameworkNameFolder/" - the 2 points indicates to go one folder up.
Also, inside the test application target -> Build Phases -> Link Binary With Libraries:
I had to remove the framework file, clean the project, add the framework file again, compile and this also solved the issue.
The new version contain fix for this, feel free to update.
Or you can just replace
#include "iPhone_View.h"
with
#if UNITY_VERSION < 450
#include "iPhone_View.h"
#endif
Delete the unit testing from your project follow the below steps this will solve the issue.
select your project from the project navigator to open the project editor. From the target delete the test from the left side of the project editor and press the Delete key.
I know this is old, but I'm gonna chime in anyway because it may be useful to someone. If you can still see the file in Finder, then click on the file in your project and delete it, selecting "remove references" and not "move to trash".
Once the reference is removed, drag and drop the file from finder into your project again and it should sort itself out.
Just adding another thing that worked for me :
react-native link
Evidently my ReactNative files were no longer there. I could figure that out by clicking on
Build Phases -> Link Binary with Libraries ->
Then right clicking a file I knew was responsible for React, and clicking Show In Finder .
But nothing opened. So assuming the library went missing, I just ran the above command which relinked everything again.
Also if you havn't, try :
rm -rf node_modules/ && npm install
This happened to me after I renamed a file. For some reason it was still looking for the file with the old name. What I did was create the file that it was complaining about and added to the project. Then I did a Project->clean, then Project->Build and verified the error was gone. Then I selected the newly added files and deleted them. This removed all references and I no longer see the error.
I fixed mine. The fb sdk downloaded (from my browser) as 'FacebookSDKs-iOS-4.22.0' -- I just had to rename the folder to FacebookSDK. So now in Build
Settings --> Framework Search Paths
the path looks something like /Users/.../Documents/FacebookSDK (where as before it was /Users/.../Documents/FacebookSDKs-iOS-4.22.0)
Hope this helps!
For what it's worth, my problem was completely unrelated to the error Xcode was giving. I stumbled onto a solution by deleting the .h reference, compiling, adding the reference back and compiling again. The actual error then became evident.

Cannot include boost libraries in Ogre iPhone SDK version

I installed the Ogre3D iPhone SDK and tried to compile the sample project in XCode4. I ran into "lexical or preprocessor issue" which many people have been experiencing in XCode4. In my case, XCode was not able to fine "OgreCamera.h".
I managed to solve this problem by creating an "Indexing" group folder in my project and dragging the header files into it as suggested in this thread:
Compile, Build or Archive problems with Xcode 4 (and dependencies)
However, I ran into the same issue again in a different form. There are no more errors about "OgreCamera.h", but now I'm getting "'boost/thread/tss.hpp' file not found". I've dragged the boost folder and the individual boost header files into the Indexing group, to no effect.
All my include paths are configured correctly, XCode should be able to find these files based on my build settings.
I don't know what to do. I've searched for solutions to this and failed to find any. My best guess is that the contents of the Indexing group need to be a flat hierarchy with no sub folders, but Ogre references the boost headers files using a file path: "boost/thread/tss.hpp", and this causes problems for some reason. But I don't know how to go about fixing it.
Does anyone have any suggestions?
Thank you.
I had the same problem. I was copying boost into the root of the OgreSDK and then adding the following to my header search paths
$(SRCROOT)/boost
You'll notice the file being included is "boost/thread/tss.hpp". So using the above header search path it would be looking for $(SRCROOT)/boost/boost/thread/tss.hpp.
Assuming you have $SRCROOT/include in your header search paths - the solution is just to move the boost folder to your include directory.
PS... if you don't have a boost folder you'll need to download boost and copy it in there.

SDWebImage building for archive (distribution)?

I am using the SDWebImage open source project for loading images asynchronously.
I can build & run for the simulator as well as for my local device.
However, when i try to build for distribution (i.e. Archive), the compiler doesn't seem to understand what the header file is:
import "UIImageView+WebCache.h" (no such file or directory).
I pretty much followed the instructions, with relative ease, described here on
github.com/rs/SDWebImage.
I knew things were going way too smoothily/easily to be true.
Oddly, i've never really faced an issue that is exclusive to Archiving.
Anybody tried Archiving with SDWebImage before?
* Updated *
I updated based on comment below. Now i am getting the following error while Archive building:
arm-apple-darwin10-llvm-gcc-4.2:
Poll/BuildProductsPath/Release-iphoneos/libSDWebImage.a: No such file
or directory Command
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2
failed with exit code 1
The strange thing is that i have the sdwebimage.a file in my project (there's actually 2, one that i copied and included, and the 2nd one from the SDWEbImage project itself).
* Update 2 *
Upon further investigation, my SDWebImage project is NOT getting built when i Archive (the .a file is red). But any other build type works fine. I looked everywhere and it seems like the SDWebImage project has the distribution configurations. Not sure what else could be the issue here.
You can keep your setup as you have it. All that is needed is to add the header files to the search path. To add the needed header files to the search path do the following.
Select your project file
Select your target
Select Build settings
In the search box enter 'header search paths'
For the Release add "$(SOURCE_ROOT)/SDWebImage" (thats
with quotes).
This works when importing like this #import <SDWebImage/UIImageView+WebCache.h>
So, I have and may others had had this same problem. I worked on it for awhile this morning and found all the suggestions are not working.
How I got it to work is to add the Workspace lib to your project, as it stated in the instructions. Make sure the file isn't red, I had to play around removing it and adding the header search path again.
Finally, I was able to see the libSDWebImage.a file.
Right click on that file and "Show in Finder"
Move libSDWebImage.a and SDWebImage/.h files to a directory you will not delete
Add the libSDWebImage.a and SDWebImage/.h files to you project
You can archive now.
Hope it works for you.
I tried all of the above methods of adding header paths.. nothing worked. I'm able to build the project fine in debug but not archive. I just tried something simple and it did work.
The file "UIImageView+WebCache.h" is part of the subproject SDWebImage.xcodeproj.. In my main workspace project I simply did "Add File" and found the "UIImageView+WebCache.h" on disk and added it to my main project. Now that file is part of my main project. Ran Archive and it worked.. I little dumb, but it worked at least
I solved it very easily by adding (with quotes):
"$(SRCROOT)/SDWebImage"
to the various Header Search Paths under my project's Build Settings. Thanks to Lizard in SDWebImage/UIImageView+WebCache.h file not found for his solution.
For me this one worked, when addded to Header Search Paths (it is exact path to the SDWebImage project)
"$(PROJECT_DIR)/ProjectName/Libraries/SDWebImage"

Facebook Connect in Iphone header include path

I am trying to compile facebook library for my iphone application. But I am getting this error.
error: FBConnect/FBConnect.h: No such file or directory
I have added the location of the folder in header search paths and yet it is not compiling.
This is the path that I have added-
/Users/nishant/Downloads/facebook-facebook-iphone-sdk-1059eb6/src.
I even tried the copy files to destination folder option, but that also did not work.
I know this is a very simple step, but I am getting frustrated, because I have tried this like 20-30 times.
Any help.
There’s a User Header Search Path between the Build settings for your target. Set it to the root directory of the Facebook library code and it should build fine. (I have spent a while with the setting myself.)
You can check if the file is added to you current target - just expand 'Compile Sources' section in your target and see if the file is there.
I too tried this for some time and finally imported the below line
import "FBConnect.h"
instead of #import "FBConnect/FBConnect.h"
voila! it worked like a charm.

Problem with header files of ARToolkitPlus after making the ARToolKitPlus dylib!

I'm writing this Augmented Reality app for the iPhone and I'd decided to use ARToolKitPlus for it. Using QMake, I created the xcode project file and subsequently the libArToolKitPlus.dylib
I tried to compile and run the sample files "simple" and "multi" which worked well. Now all other attempts that I tried to create another project and use the library have failed due to header files not being found. If I drag the "include" folder to the xcode project I get 8 errors instead of just one; The one is for the main include not being found is solved but then it includes 8 other headers that cannot be found (although they are in the same folder)
#include "ARToolKitPlus/TrackerSingleMarkerImpl.h"
I get a error: ARToolKitPlus/TrackerSingleMarkerImpl.h: No such file or directory
If I drag the include folder then some of what I get:
error: ARToolKitPlus/TrackerSingleMarker.h: No such file or directory
error: ../src/TrackerSingleMarkerImpl.cpp: No such file or directory
error: expected class-name before ',' token
class TrackerSingleMarkerImpl : public TrackerSingleMarker, protected TrackerImpl<__PATTERN_SIZE_X,__PATTERN_SIZE_Y, __PATTERN_SAMPLE_NUM, __MAX_LOAD_PATTERNS, __MAX_IMAGE_PATTERNS>
Having the dylib doesnt make a difference as far as I can tell. What do you think I should do?? Would creating a framework help??
I'm not sure its ok "copyright wise" to do so. But here's how to do it.
In XCode, create a new group called: ARToolKitPlus (or whatever u like).
Drag the "src" and "include" folders from the original ARToolKitPlus folder to the group you created.
Find the location of both the "include" and "src" folders by right clicking on each and selecting "Get Info"
Copy these paths in the "Get Info" window.
Open the project settings, choose "All configurations" and find "Header Search Paths", you can search for it directly.
Add the paths you copied from the info window to the header search paths, make sure you compensate for spaces (or even better, have no spaces in your paths).
Confirm and make it recursive, and voila!
I figured this out... It was an xcode problem, it was not including the "include" folder in the header search path. Did that manually and the problem was solved!