So I feel like this should be a simple problem, but I can't get the
'kazmath/...h' file not found
error to disappear (specifically kazmath.h and mat4.h. This might be an extension (or revisit) of this question.
Here's an overview. I have a workspace for games and adding them individually as sibling projects. The one I just added uses Cocos2d. It seems to compile by itself, but when I try to link it to the workspace, the workspace gets errors that it can't find the kazmath folder. It is in the game project itself, and I have tried adding it to the workspace, but that doesn't seem to work.
Can anyone give a quick rundown on either adding projects to a workspace and linking them in or on how to properly link header files?
Some notes: I've added the path (Arcade/libs/kazmath/include/) in Header Search Paths for the build settings. I've added the -lz and -ObjC flags for the Other Linker Flags.
if you attempt to set Project Wide Header Search Paths section
and you forgot a wrong section in
in Target that maybe wrong overridden may cause keep this error occuring.
so delete targets>BLAHPROJ>Header Search Paths setting and keep this setting in ONLY Project Wide.
this fixes problem too
Maybe this is the same problem as I have, which I am answering here because I have not found anyone giving this answer and maybe it will solve this issue for others.
I kept "fixing" the path in my Project target but, using a demo project as a template which builds a separate Cocos2D target, I should have been changing the "Header Search Paths" there.
--forehead slap!--
I am a bear of very little brain.
Related
When I'm writing simple code in ViewController, I wanted to run it and boom. Apple Mach-O linker error as shown. I don't know what is the problem. Then, I've made a quick research, according to research; I deleted Derived Data folder, I deleted Derived Data folder contents, I deleted test hosts in build settings(it is already empty), I cleaned the build folder and I applied clean action. But nothing changed same errors. Is there any specific solution of this error depends on app and what is that solution?
EDIT:
I moved the codes to a new xode project and I noticed that when I add the line let ftp = CkoFtp2(), the error occurs otherwise it compiles. But it is coloring the CkoFtp() part of line and I'm not getting any specific errors there. Just Match-O and linker command.You can see the CkoFtp2 code here.
I had the same issue. Please make sure to follow the directions on chilkat's site, particularly the following:
Add libChilkatCocoa.a to your list of libs for linking. In your project build settings, find Build Phases, Link Binary with Libraries, select Add Other, navigate to the libChilkatCocoa.a, and add it.
The Chilkat library internals are written in C++. Therefore, your Swift application will need to link against the C++ runtime libraries. In your Build Settings, go to the Linking section and add -lstdc++ to the Other Linker Flags.
https://www.chilkatsoft.com/chilkatSwiftCocoa.asp
I also ran into trouble because the libChilkatCocoa.a library resided in a folder that had a space in its name. Avoid that, or make sure it is correctly escaped under Build Settings.
Looks like you've got a reference to a framework located in your Downloads folder. Chances are you moved that somewhere else, yes? Remove the SimpleUnzipper framework from the project and re-add it from wherever you moved it to.
After the edits, this is clearly not the problem...
It's hard to tell from just the error message, but it appears that you're using a library that you downloaded from another developer. Are you sure you followed their instructions for setting things up? The linker error means that you're not linking your program with the library, though it looks like you've managed to set up a bridging header so that you can call the function without getting a compiler error.
I am trying to use GDataXMLNode to parse an XML file. I am following the tutorial on this blog:
http://www.raywenderlich.com/725/xml-tutorial-for-ios-how-to-read-and-write-xml-documents-with-gdataxml
My problem is trying to add the GDataXMLNode to my project and getting it to work. I'm supposed to do something with the configurations, add a Header Search Path, and a few other things, but every single example I've found online is for a previous version of Xcode. I'm currently using Xcode 5 and I have tried everything (PLEASE prove me wrong), but nothing is working the way it's supposed to in this tutorial.
So, any help as to how I might go about this and get it working together with my iOS project would be much appreciated. Let me know if I can expound on anything I've said.
You should select "All" in Project Settings to show all the parameters, including "Header Search Paths" and "Other Linker Flags".
It's quite easy, follow instruction but remember that GDataXMLNode does not support ARC. You can do the same instruction as Andrey. But I think it should be located in a sub-project, for example: Library.xcodeproj. If you want to organize your code formally.
Firstly, create Library.xcodeproject, add GDataXMLNode. In Build Settings, you also include "Header Search Path" and "Other Linker Flags". But don't forget that GDataXMLNode does not support ARC. Go to Build Phrases, under Compile Sources menu look for GDataXMlNode.m set a Compiler Flag for it with: -fno-objc-arc
Now, for any sub-project you want to use this library, just go to Build Settings, in User Header Search Path properties choose: ../IPLibrary/** or ../IPLibrary and choose rescursive option.
Now you can include GDataXMLNode. By the way, your project looks more professional, due to lib and source code is split separately. Good luck.
I'm having trouble linking to a static library in Xcode 5. I did read the chapter on building and using a static library in the Pro iOS 5 Tools. What it told me to do after creating your static library, was to link against the framework in the Build Phases tab. That part is pretty straight forward. Then it says in the Build Settings, under "Header Search Paths", to add:
$(BUILT_PRODUCTS_DIR)
Then in order to use my static library, I just import it like so:
#import "ConversionCalculator/ConversionCalculator.h"
So this used to work up until yesterday. I tried adding a new static library to my project which didn't seem to work. So I cleaned my project, and tried rebuilding again, but now Xcode complains about #import "ConversionCalculator/ConversionCalculator.h". It says
Lexical or Preprocessor issue. 'ConversionCalculator/ConversionCalculator.h' file could not be found.
I was wondering if anyone has any tips on debugging this. I've looked through different tutorials like this:
http://blog.stevex.net/2012/04/static-libraries-in-xcode/
http://cocoamanifest.net/articles/2011/06/library-management-with-xcode-workspaces.html
http://www.raywenderlich.com/41377/creating-a-status-library-in-ios-tutorial
But I can't seem to find the "golden way" to link to a static lib, or how to troubleshoot why Xcode cannot find my file. My file structure is setup on my machine like so:
Projects\
DistanceCalculator\DistanceCalculator.xcodeproj
ConversionCalculator\ConversionCalculator.xcodeproj
DistanceCalculator.workspace
Like I said, this all used to work too when I followed the tutorial in Pro iOS 5 Tools book. Now I don't know why my workspace cannot find ConversionCalculator when it has used it before. The part I find hard is different articles say different things about the header search path, and I'm not sure what the best way to populate that field is. Any thoughts? Thanks in advance!
Edit:
I'll add that I can build for the device without errors. But when I switch to the iPhone simulator, it gives me that error about not being able to find the file. I also see that I get this warning:
ConversionCalculator was rejected as an implicit dependency for 'libConversionCalculator.a' because its architectures 'i386' didn't contain all required architectures 'i386 x86_64'
Looking at that, I'm not sure what that means. If it means that my library is not being built for all architectures, I just tried creating a Target that builds for all architectures according to the wenderlich article in the above link. That seems to work as when I go to the dervieddata folder, I see for debug, release, and universal, I see the libConversionCalculator.a file. But then when I go back into the workspace and try to rebuild the project for the simulator, I get that could not find file error and the implicit warning.
Edit #2:
I just saw a warning flag on Xcode that says upgrade to recommended Build Settings. Now I get no errors. Not sure what happened... but I guess no errors is good.
I would follow the description available in Xcode's Help topic "Linking Against Your Library" in chapter Configuration Your Application in Introduction to Using Static Libraries in iOS
(you may search within Xcode Help, too).
Except that I would recommend to include your headers from libraries always using angle brackets:
#import <ConversionCalculator/ConversionCalculator.h>
Using double quotes may inadvertently search and find files with the same name in some sub-folder relative to the file where this import directive is written. Only after there was no file in any sub-folder the preprocessor starts searching with the specified header search paths.
Using angle brackets, the preprocessor immediately searches only at the specified header search paths.
So, since you actually want to find headers for the corresponding library, always use angle brackets.
Note: If you follow the recommendation to create a static library project, you don't need to explicitly set a header search path in the target that links agains the library: Xcode will already add a search path:
$(BUILT_PRODUCTS_DIR)/includes
Your library headers are located in
$(BUILT_PRODUCTS_DIR)/includes/<product-name>
which are placed there through the "Copy-Files" phase of the iOS static library target, whose "Destination" is set to "Products Directory" and whose "Subpath" is set to "includes/${PRODUCT_NAME}" per default.
You may change these default settings to other reasonable and sensible values. (if you do, consider the the consequences for Xcode's default search paths!)
So im trying to use the route-me widget in my app, but xcode keeps complaining that it cant find FMDatabase.h, yet its included in the project (albeit under a different project that is included into my project). I've copied how a sample app has been made yet the sample project doesnt get this error. The RMDBMapSource.h file is contained within the MapView project, so i shouldn't need to include the fmdb stuff myself (and because the sample project doesn't do that)
Surely if the files are under compile sources / copy headers under build phases, that means it should be able to find the file? This is a pretty lackluster explanation of my problem, but if anyone has used the route-me library before maybe they have had the same problem and can point me in the right direction
Resolved my own mistake. First off in the build settings of the main project, the 'search for header paths' was not set correctly, it was set to /MapView/ instead of /MapView/** that resolved the FMDatabase.h missing error.
Then in case someone else had a linker error like i did after i resolved the first issue, make sure you have libMapView.a included in your link binary with libraries section. (i had it their before, but during a version control commit, somehow our project file decided to not add that library anymore and i had totally forgotten about it, so took me quite a while to find out that it was missing)
I can't seem to make Xcode find the Core Plot header. I've done the following:
Clone the hg repo;
Drag the CorePlot-CocoaTouch.xcodeproj file into my project;
Opened the CP project and compiled it successfully;
Dragged the lib file into the target's static link list;
Added CorePlot-CocoaTouch as a direct dependency for the target.
But I'm still getting the "CorePlot-CocoaTouch.h: No such file or directory" error on compile. I've been googling around trying to find an answer, but only seem to find a few people having the same problem but no clear solution. What have I missed?
I found what I was looking for about the same time, even though I'm coding for Mac. The solution assumes the core-plot directory is where your Xcode project is. In my app's target settings, I set this for framework (not header) search path:
"${PROJECT_DIR}/core-plot/build/${BUILD_STYLE}/${EFFECTIVE_PLATFORM_NAME}"
Quotation marks important. And that was all I needed to do!
The answers I needed are shown on this blog post, although I found I could use a relative location for the header search path rather than an absolute one. Also don't forget to add -ObjC to the linker flags, as well as -all_load until the bug has been fixed (see this comment).