lexical or preprocessor issue file not found occurs while archiving? - iphone

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.

Related

'RevMobAds/RevMobAds.h' file not found

I am unable to find the problem of this Error. Can anyone guide me. How to fix given below error.
I had added the revmob sdk in my project and i had also checked the box "Copy to destination if needed." And i also checked it is there in the xcode project. but still given below error is not going. This not my first time i am integrated revmob. but do not know why suddenly this error starts appearing even this code is working fine before.
Error
'RevMobAds/RevMobAds.h' file not found
I call this the "Phantom Folder issue"...
I had an issue where I deleted the RevMobAds.framework from within Xcode but when I tried to re-add the newer SDK by dragging and dropping into Xcode into a different folder (copy was checked and targets were checked), it would appear then give me the same error: 'RevMobAds/RevMobAds.h' file not found
It turns out that when I checked the real project folder in Finder (not from within Xcode) that an empty RevMobAds.framework folder was left behind.
So what I did was:
(1) From Xcode, deleted the RevMobAds.framework that I had added.
(2) Went to the real project folder in Finder and deleted any phantom/leftover folders named RevMobAds.framework that were still there.
(3) Dragged the RevMobAds.framwork SDK back into Xcode (making to sure to check COPY and targets).
And this solved the problem for me.
Right Click on your App in groups and files section, Select Add files to "your app"....
Once you do that, select folder you want to add and select "Copy items into destination group's folder (if needed)" as shown in screenshot below.
Note: Copy items into destination group's folder (if needed) is to be selected only if the files are physically in some other folder and not the application bundle or application folder.
Ok, finally I managed to solve this. I read a lot of questions here, and searched online.
This article help me out a lot.
So, what happened to me, is that the library files, that were giving to me were missing some files and shortcodes.
So, I just:
Downloaded the new version of the library. Link here.
Copy to my project folder.
Add it to the Header Search Path. (Build Settings, Search Path, Header Search Paths. Add something like $(PROJECT_DIR)/RevMobAds.framework)
And a Clean, Build.
And that's it.

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.

Command /Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

I'm trying to do an application reading pdf using pdf kit in Xcode 4.3 but it gives me the following error
ld: duplicate symbol _OBJC_METACLASS_$_OverlayManager in /Users/dt4it/Library/Developer/Xcode/DerivedData/MyPdf4-bmkjglhhvneluqcbwpceiqjvdcmq/Build/Intermediates/MyPdf4.build/Debug-iphonesimulator/MyPdf4.build/Objects-normal/i386/OverlayManager-D0866CFD31A05E68.o and /Users/dt4it/Library/Developer/Xcode/DerivedData/MyPdf4-bmkjglhhvneluqcbwpceiqjvdcmq/Build/Intermediates/MyPdf4.build/Debug-iphonesimulator/MyPdf4.build/Objects-normal/i386/OverlayManager-B31AE7412100AF6D.o for architecture i386
Command /Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
any help please ??
Project Settings > Under "Targets", select your project > Build Phases >
open "Compile Sources" and "Copy Bundle Resources". Check if any files are listed in red color. If so , just delete it. Then clean and run.
Worked for me.
Do a clean. product > clean . Terminal purge & reboot didn't work for me, cleaning did.
I had this same error and nobody seems to have an answer on StackOverflow that actually works. My problem was when I tried copying a project that was in a team repository. Turns out, in the ignore file, all files with the extension of *.pch were ignored from repository commits. This means that when I went to pull the project from the repo, the .pch file was missing, thus throwing this error.
Fortunately I had a copy of the project still and was able to just copy the .pch file over and I was then able to compile just fine.
Hope this helps?
Go to target preferences, summary tab, find "Deployment target" and increase it.
deleting ~/Library/Developer/Xcode/DerivedData helped me.
reference : link
I face this problem too. And ofc I looked for help in SO instead of use the common sense and check the error message.
The last part of the error message was the same as you.
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 11
But few lines above I found:
In file included from /Users/Ricardo/Documents/XCode/RealEstate-Finder-v1.2/RealEstateFinder/RealEstateFinder/RealEstateFinder-Prefix.pch:26:
/Users/Ricardo/Documents/XCode/RealEstate-Finder-v1.2/RealEstateFinder/RealEstateFinder/Config/Config.h:174:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
http://www.myserver.com/apps/mobile/rest.php?id=12
Which points to my Config.h file.
Happy coding!
You have accidentally included the .m file OverlayManager instead of the .h file inside the actual OverlayManager class itself! Basically, he compiler already knows to compile the .m file, but when you #import it, the compiler tries to include it inline with that same source file, thus generating duplicate symbols. But your case is unique, seeing as you are #importing the .m of the actual class' .m file! It's recursively compiling your OverlayManager class.
The same thing happened to me and i found that i forgot to put the " at the end of the
#import "CPDConstants.h
so instead
#import "CPDConstants.h"
For me this error appears after cloning the project from a repository. Someone removed a white space from the projects name (renamed: "The Project" to "TheProject") which caused some Build Settings errors to unvalid paths.
Sometimes reading the whole error logs is not a bad idea....
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.
This problem usually occurs when there are more than two versions of XCode are installed in which different Swift versions incorporated for Ex. XCode 6.4 and XCode 7.3 are installed which are running Swift 1.2 and Swift 2.0. By mistake you tries to compile code with icorrect version for Ex. your project in in Swift 1.2 and you tries to compile it with xcode 7.3. In this case drive data stores information for swift version but when you tries to compile code with correct XCode it gives error.
To resolve this
Delete drive Data
a. In Xcode select preferences
Once preferences are open click on Location tab and click on the arrow in front of the 'Drived data' path. It will open drived data folder
Quit Xcode
Delete all drive data.
reopen the project in correct XCode error is fixed !!!!!!
The thing to consider here is the *.pch file. If you're doing an include from an external library then you have to make sure you're doing the include after #ifdef OBJC and before #endif. If you try to do your include outside this condition this might be a cause of the compiler error.
Had this happen in a team using git. One of the team members added a class from an external source but didn't copy it into the repo directory. The local version compiled fine but the continuous integration failed with this error.
Reimporting the files and adding them to the directory under version control fixed it.
I too had this error. But in my case, and I'm sure I'll be a one off here, I had accidentally deleted main.m when I hit the delete key after the app had crashed on the iPhone simulator.
After a crash, Xcode shows the main.m file and when I had hit delete, I had accidentally deleted the main.m file from my project, as it is easy to do when a file name is highlighted, not the code in the detail view.
Main.m normally resides in a group or folder named supporting files in the project file manager. I had not noticed this happened until it failed to build and run next time around and then I had to re-read the error message more closely and saw it said main.m is missing.
Thank you all for your input, but just in case there is someone in my position check for any file names in red showing missing files and restore them from a backup if you have it.
Adding the missing files(files in red color in Xcode->target->Build Phases->compiled sources) to the target folder resolved the issue for me.
My problem was that under Build Phases -> Compile Sources, I added a compiler flag for a file, but I had misspelled it. It was supposed to be:
-fno-obj-arc
to show that this file does not use ARC.
May be it will be helpful for someone:
I had the same error after deleting several files from project. After having deletes committed in git repository this error has gone...
Xcode 8
#Spoek's answer is right,
But If you won't find file in red color, then find the one with low opacity,
see this image,
The first one is there but second one is note there, so delete it.
My case, I fix it by:
Go to Build Phases and check Compile Sources files, check if it has duplicate file, just keep one.
In my case it was a duplicate Swift Flag entry inside my Target's Build Settings > Other Swift Flags. I had two -Xfrontend entries in it.
In my case,
Build Phases -> check Compile Sources files -> delete xxx.swift files that xcode says "can't find "xxx.swift"
This happened to me and it took me an hour to find it. In my case I had typed too fast and did:
[seld method];
instead of:
[self method];
Seriously! I don't know why it didn't catch this in a more recognizable way. But it was of course looking for a class called "seld".

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"

Three20 linking error on iPhone simulator

After following all the instructions on http://three20.info/setup/existing to integrate three20 library into my project. I'm getting this linking error:
duplicate symbol _TTCreateNonRetainingArray in /test XYZ Photos App/Three20/Build/Products/Debug-iphonesimulator/libThree20Core.a(TTGlobalCore.o) and /test XYZ Photos App/Three20/Build/Products/Debug-iphonesimulator/libThree20.a(TTGlobalCore.o)
What can I try to resolve this?
Ok, after hours of figuring, I was able to solve this.. The answer is Three20 won't compile if your project is inside any parent folder with a space character.
I still had the same problem even after removing spaces in parent folder names (and deleting build cache, etc.), this is what worked for me (see https://github.com/facebook/three20/issues/issue/210/#issue/210/comment/526603):
In three20 install instructions step "2. Locate the "Three20.xcodeproj" file under "three20/src/Three20/" when I created a "Folder Reference" instead of a group reference, it worked. For the subsequent Xcode projects that get added, the "Folder Reference" radio was grayed out, but they all added properly and it worked after that (note that I had to re-do the subsequent step of adding Direct Dependencies to the targets).
When i was using the samples I met that problem, but there was no space in the name of my project folder. So i just downloaded a new project and compile correctly.
All necessary system libraries are linked such as QuartzCore and CoreGraphics?
Libraries set see in Samples of Three20: TTCatalog.