Class in a Framework not found - frameworks

This was my first attempt at making a framework in Xcode and it's structure is something like:
framework.h
framework.m
class1.h
class1.m
I am now trying to make a console application that uses the framework. I have added it to the Linked Frameworks and Libraries, and put in the file path to the derived data folder that contains the framework into the Framework Search Paths.
When I try to build the console application, I get the error 'Class1.h' file not found.
Am I not building the framework correctly or not including it as I should? I also tried copying the framework to my Library/Frameworks folder though it didn't put it there automatically, and I got the same error.

The solution was to make the 'Class1.h' header file public in the project headers. I also needed to make a lot of other header files public because they were included in Class1.h, but everything builds smoothly now.

Related

Static Library path nightmare from hell

This is the point. I have a subproject (static library) created. The library compiles well. No errors. When I include this library inside a project and imports a header from that library on the project the library fails to compile because it cannot find a path that belongs to itself.
After following a bunch of tutorials on the web on how to create a static library and embed that in a project, I don't know which one is the correct one, because I have tried all and all failed and some differ.
This is how the library is set:
STATIC LIBRARY
BUILD SETTINGS:
Public header folder path = $(BUILT_PRODUCTS_DIR)
Header search path = $(SRCROOT) (recursive)
BUILD PHASES
COPY FILES = 1 file, myLibrary.h that is basically empty (created by xcode when I used the static library template to start the library.
no ADD COPY HEADERS phase
MAIN PROJECT
BUILD SETTINGS
Header search path = empty
User header search path = $(BUILT_PRODUCTS_DIR) (recursive)
Always search user paths = YES
BUILD PHASES
Yes, myLibrary.a is on target dependencies
What amazes me is that the library compiles fine alone but when put inside a project, is unable to find a header that belongs to the own library.
NOTE: I have also tried to create a copy headers phase on the library making public all .h on that library, but it failed too.
This is an example of one error:
/Users/mike/Library/Developer/Xcode/DerivedData/MyApp-dnaimaovscreasadhmvgttwjnabc/Build/Products/Debug-iphoneos/include/myLibrary/ccTypes.h:39:9:
fatal error: 'Platforms/CCGL.h' file not found
#import "Platforms/CCGL.h"
I have lost two days trying to solve this nightmare.
any thoughts?
I have uploaded a sample project to here and here
After downloading your sample project, I had it working in a few minutes by making the following changes.
First, you need to add an entry for the MyProject target's Build Settings under Header Search Paths, so that the files such as HelloWorldLayer.h, which #import "cocos2d.h", know where to find that file.
Under the Header Search Paths, I entered ../MyStaticLibrary/MyStaticLibrary/libs/** like shown in the image below:
That solved the problem of the inability of the preprocessor to find the necessary source files from the MyStaticLibrary, for the MyProject project, but after compiling, I got an error about missing symbols. I needed to add the built libMyStaticLibrary.a to the Link Binary With Libraries step like shown in the image below:
After that, the project compiles fine.
(Not enough rep to post comment...)
Did you try specifically including the Platforms directory in the header search path? Presumably, Platforms is in the source directory, not in $(BUILT_PRODUCTS_DIR) so may not be searched in your current setting.
Regarding script to show you env variables, here's how I do it (open images at the new tab for better scaling):
Added dummy shell script
Observed its output at Log Navigator
As you can see, BUILT_PRODUCTS_DIR doesn't have any headers copied from the library. Either put headers there manually (strongly not recommended) or add search path to the location that you know the headers must be at:
Now as there were two headers cocos2d.h and MyStaticLibrary.h, cocos2d.h was successfully imported although it will have additional dependency.
The path ../MyStaticLibrary/build/$(BUILD_STYLE)-$(PLATFORM_NAME) will also (recursively) have public headers of the library.
After almost 5 days of a nightmare trying to solve that, I finally found this tutorial: http://www.youtube.com/watch?v=XUhLETxgcoE
This is the only solution that worked for me. The simplest and the best.
Thanks for every one trying to solve this.
Please try this…
step1: right click on the 'projectName.xcodeproj'(static library).Choose 'Get info' and copy the full path from(General->where)
step2: Paste full path to 'Header search paths' for your main project(Both Targets and Project )

Fatal error: Class 'Zend_Form' not found

I've started using Zend framework, and Im following this simple Zend form tutorial. The form is located in application/forms directory I have included the Zend framework in the Path (by going to computer properties). However when i access form.php page, i get this error:
Fatal error: Class 'Zend_Form' not found
I have also tried by copying the Zend folder from the Zend framework in the library folder of the application, however error still remains same. Thanks.
It sounds like you are confusing two notions: the system path and the include path.
The system path is an operating system concept. When you ask the OS to execute a command, the system path is a list of places to look for the executable.
In contrast, the include path is a PHP concept that tells PHP a list of folders in which to look for files invoked by PHP include/require statements.
Any path that you find in "Computer > Properties" is almost certainly the OS-level system path. What you need to do is to make sure the Zend folder on the PHP include path, either by moving the Zend folder or by modifying PHP's include path to include a point to the Zend folder.
In a typical ZF app, the include folder is set in index.php (the front controller). So, the only explanation for not finding Zend_Form is that the autoloader is not being instantiated.
If you are using Zend_Application, this happens automatically. However, it seems like you are bypassing public/index.php and the whole Zend_Application instantiation by trying to directly "access" a file called form.php directly. If this file contains only the definition of your form (extending Zend_Form), then the absence of autoloading could easily explain the error message you are getting.
I'd try instantiating the form in a controller action, by which time in the request processing cycle, the autoloading is probably already in place.
[At that point, given the file locations you cite, we might run into a resource-loader issue, but that's a somewhat different issue that can be handled by instantiating a Zend_Application_Module_Autoloader in your Bootstrap.]
It looks like you do not use Zend_Loader. You should focus on it.
You can also manually in your custom form class include Zend_Form class.

Converting Framework to a Library

I want to use the framework found at the link below within an iOS app. I have it working within the simulator but after some digging it looks like you are unable to use frameworks on devices and especially when distributing through the App Store. Please correct me if I am wrong.
https://github.com/mirek/YAML.framework/
How would I go about converting this framework to a library? I have looked at simply dragging the files from the framework to the app which doesn't work.
Thanks in advance.
It's super easy.
Give the general iOS static framework structure:
3rdPartyLib.framework
|---3rdPartyLib -> Versions/Current/3rdPartyLib
|---Headers
|---Resources
|---Info.plist
|---SomeBundle.bundle
|---Versions
|---A
|---Current -> ./A
You have to
1) Copy the static library file in a new folder
3rdPartyLib.framework/Versions/Current/3rdPartyLib
2) Rename is with .a extension and copy to a new folder
3rdPartyLib/
|---3rdPartyLib.a
3) Copy all the headers in the folder
3rdPartyLib.framework/Headers
in a new headers folder in the new folder
3rdPartyLib/
|---Headers/
At this point you should end up with
3rdPartyLib/
|---3rdPartyLib.a
|---Headers/
This is your static library that you can use within your app or within another iOS framework to be distributed to other apps.
Take a look at this: https://github.com/Ecarrion/YAML.IOS
Just grab the YAML.Framework folder
And you actually can use framework, you just can't use dynamic libraries.

importing private frameworks in Xcode

I am a novice iPhone programmer I want to use some of the functions in the private framework
https://github.com/kennytm/iphone-private-frameworks
The function that I want to use is in 'SpringBoard'
So I downloaded 'SpringBoard' folder in that github repo.
And created a subdirectory called "Headers" in 'SpringBoard'
and put all the header files in that folder.
And renamed 'SpringBoard' to 'SpringBoard.framework' and copied it to /Developer/Platforms/(iPhoneOS_and_iPhoneSimulator)/sdks/System/library/Frameworks folder (I can't recall full path correctly sorry)
And I got back to the xcode and right click on Frameworks -> Add existing framework -> other -> I selected 'SpringBoard.framework' folder and clicked Add.
And I built the project and got an error
'ld : framework SpringBoard not found'
My imported framework does appear on the Xcode and I can see header files in it.
but when I built it I got that error.
What am I doing wrong?
Place all of your private headers in a directory like: /User/Name/Headers/ then set USER_HEADER_SEARCH_PATHS = "/User/Name/Headers/" and make sure that ALWAYS_SEARCH_USER_PATHS = YES
Also, SpringBoard.framework is not the way to do that.Simply place the folder named SpringBoard in the above Headers folder, making sure that the headers are directly inside them. For instance: SpringBoard/SBAlert.h
/* SpringBoard is not a framework. */
Notice that you wont have to add the SpringBoard folder to your project, they should appear as you start typing, as long as you set the above headers correctly.
I'm not sure if this works, but here a suggestion:
I think the spring board framework should be in the UIKit framework you already linked anyway, so just add the header file to your project and it should work.
Otherwise this could help you:
http://www.codethecode.com/projects/class-dump/

GWT-VL FRAMEWORK

I am trying to use the GWT-VL framework to validate my client side form.So as the first step i downloaded the .jar file from sourceforge.net and imported it into my projects libraries.
Then i write a class which tries to use the validations.
The error which i get is "No source code is available for type eu.maydu.gwt.validation.client.ValidationProcessor; did you forget to inherit a required module?"
So my question is does my class which uses the validation framework need to extend any class?
Or is there any problem with my importing the .jar file?
I think it should be not because i have added this .jar files to my libraries.
Or is there any other modification in need to make?
Also please suggest any other frameworks for validation of GWT-forms.I am just trying to integrate GWT-VL to play around with it and see if its convenient for usage.
Thanks
You have to add the following line in your module.gwt.xml file:
<inherits name='eu.maydu.gwt.validation.ValidationLibrary' />
The class that uses the validation library does not have to extend a special class.
You should update your module XML file, (modulename.gwt.xml) and add a reference to the framework you are using.. The required modification should be in the readme file of the downloads 90% of the time.