.dylib linked in Debug, not found for Release for iPhone in XCode - iphone

So I have included the libxml2.2.dylib library into my iPhone XCode project to create some Xml and XPath parsing utilities. When I compile and run in Debug mode for both the Simulator and Device I have no problems, however, When I switch to Release mode I get...
"error: libxml/tree.h: No such File or directory" as well as other similar errors for the following .h files.
#import <libxml/tree.h>
#import <libxml/parser.h>
#import <libxml/HTMLparser.h>
#import <libxml/xpath.h>
#import <libxml/xpathInternals.h>
What do I need to do to ensure the libary is included and linked to the Release build?

An error on the .h is a compile-time error with your Header Search Paths, not a .dylib or a linker error.
You have to ensure that ${SDK_DIR}/usr/include/libxml2 is in your Header Search Paths in your Release configuration.

i was going around in circles this morning with this same problem with xcode 4.
again as described exactly above, it builds with fine with
Schema >
Build Configuration
--> Debug
but fails when switching it to Release
tried numerous cleans and
adding ${SDK_DIR}/usr/include/libxml2 or
$/usr/include/libxml2
and triple checking Header Search Paths / checking the recursive check box all to no avail.
Was about to start a new project when ....
I managed to resolve it by adding
${SDK_DIR}/usr/include/libxml2 to the User Header Search Paths

do make sure that libxml is included in your project , that was the one that caused the problem for me.
add libxml2.2.7.3.dylib to linked libraries

Related

Xcode 13 Swift project - Archive build giving me error on Objective C Bridge

I have a Swift project running on Xcode 13. The project builds perfect without any error, but when I try to Archive then I get error that is related to the Objective-c Bridge.
I have the my .h bridge file created correctly. That's why when I build it works perfect. This is only happening when I want to Archive for a publish.
This is the content of my .h bridge file:
#ifndef TestApp_TestApp_Bridging_Header_h
#define TestApp_TestApp_Bridging_Header_h
#import "ECSlidingViewController.h"
#import "DSLCalendarView.h"
#import "UINavigationController+Orientation.h"
#endif
I also have under my Target - Build Settings, the reference to the Bridge file:
Any clue what can I could try. I need this to get ready for publish.
You also need to set the bridging header path in the release section as well.

Issue With Enabling ARC in COCOS2D

im following steps from
http://www.raywenderlich.com/23854/arc-and-cocos2d-v2-x
i can not set -fno-objc-arc for ccCArray.h ... even if i have set -fno-objc-arc to that file , compiler gives warnings and errors related to ARC... like
[WARN]warning: no rule to process file 'libs/cocos2d/Support/ccCArray.h' of type sourcecode.c.h for architecture i386
ARC forbids explicit message send of 'release'
what's wrong??
That is a header file, and no header files should be compiled. You normally include <file>.h inside your <file>.m.
To fix this, click on your project in Xcode, select your target and then check that this file is not present in the Build Phases tab.
Also make sure you don't have any other <file>.h in there.
Clean and build the project.

Cannot access folder path header file in solution

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.

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".

Conflict between class and static library

I'm using Layar Player in my app.
It provides a static library to include in your project.
After installing and trying to compile, I got this error:
ld: duplicate symbol _OBJC_CLASS_$_Reachability in
//LayarPlayer/Debug/liblayarplayer.a(Reachability.o) and
//MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/armv7/Reachability.o
for architecture armv7
I'm using Reachability in my app to check network status, but it seems like it's already included in the library.
I've tried removing every #import Reachability in my code, but obviously I get "undeclared function" errors.
How can I solve this?
You need to delete the references from the project. That means don't delete the #import Reachability but search for Reachability.m and Reachability.h in your project files and delete them so you only have one of each in your project.
I excluded all conflicting .m files from the target and everything is fine now.
Headers files must not be deleted.
I solved this same problem by
check your project remove duplicate Reachability file;
replacing old version of Reachability(I'm currently using version 2.2);
put the -ObjC -all_load linker flags on.
Hope it may help.