I would like to know what a .a file is used for?
I had downloaded a SDK and what I got was a set of .h files and a .a file , may I know for what is the function of .a file ?
an .a file is generally a precompiled library file.
The .h files will have the definition of all the classes inside the .a file.
You program using the interfaces defined in the .h files, and then configure xcode to link the library in when building your project.
To actually use it in your project, add all of your downloaded files to xcode as you normally would, but there is an additional step with the library.
If you navigate to the project (using xcode 4) then select the 'Build Phases' tab you will see a number of phases. You need to select the 'Link Binary with libraries' phase and add the .a file there.
A .a file is a statically linked library. You link to this binary during the compilation of any programs you write using it and the code of the SDK will be included in the final binary of your program. It differs from dynamically linked library where your binary only references the external code.
The .h files include declarations of the functions implemented within the .a file.
Related
I'm creatic a static library to distribute to other projects (they don't see the library source code), and I wonder some questions:
-I follow this guide:
http://developer.apple.com/library/ios/#technotes/iOSStaticLibraries/Articles/creating.html
I create a .a file, several .h files and another .bundle file. The question is that my project library uses includes ResstKit (and uses it). In the product directory I see my library .a and the RestKit .a file. Do I have to distribute that restkit .a file? or is it already included inside my own .a file?
-The Apple guide doesn't say anything about fat or universal libraries. How can I create my library for the device and simulator at the same time? I see some scripts on the net, but I guess there must be some option there. What do you think? (BTW, do fat and universal have the same meaning?)
-Is there anyway to tell the target zip everything or create a DMG package? I guess using a Python script is possible, but I mean using any Xcode option.
Thanks in advance.
I have a flex project in which I need to as3xls library (.swc file) in my project. Now I have downloaded that swc file and included it in flex-sdk\frameworks\libs and I am able to use the .as files of that swc file.
Now If I have tried to put the swc file in my local project, for e.g. in one of my package of components and added it to the class path (using eclipse project properties -> flex build path) and tried to use it from that location but I am unable to compile the project as its not able to import the .as files.
Can anybody suggest the location where I should add the .swc file and use it in my project ?
If you're using Flash Builder, I generally create a libs folder under the project:
Then, reference the SWC by selecting the project Properties, ActionScript Build Path where you can either add an individual SWC or SWC Folder:
Check out my blog post on How to use a SWC.
Here is the important points:
There are three different ways that you can use the classes that
reside in a SWC file:
* Library Path in Project Properties: This is how
I use SWCs most commonly.
* Libs folder: The libs folder was introduced
in Flex Builder 3. If you put a SWC into a libs folder it is
automatically added to your library path, and all the classes in the
SWC are available from your project
* Library Path command line
argument: You can use the library path argument to the mxmlc command
line compiler.
I want to know what's the best practice to use when integrating external SDK to my project, specifically how to handle the *.a file and the *.xcodeproj file.
Examples of external SDK packages: PhoneGap, Facebook, Google-Analytic.
Is there a reason to copy the *.xcodeproj to my existing project or is it enough to just use the *.a file?
Are there pros and cons for having more than one *.xcodeproj file in a single project?
You would never copy the .xcodeproj into your app.
Typically you would add the library (./a) or any headers and implementation files required (.h & .m).
Often you would compile the 3rd party SDK xcode project to a library file and include that compiled library file.
I am trying to run the code from below link which contains C++ codes.
https://github.com/cjcliffe/CubicVR
This link contains the BeatDetektor app for iPhone. But this is developed using C++. How can i run this project?? There are no xcode project file. Also i am trying to run main.cpp file but there are lots of package files error...
below is link for BeatDetektor app
http://www.cubicvr.org/index.php?option=com_content&view=article&id=67&Itemid=82
Can anyone tell me how to run C++ file in Xcode or on terminal???
Xcode is an IDE, not a compiler. It builds targets of various types by using a compiler like GCC internally. If there is no Xcode project file, you can create one yourself and add the source files to it. As far as I know Xcode will not compile source files on their own.
Using CMake software i am able to convert my cpp project to Xcode project... As github code contains .make extension file...
I have a 2 projects in an xcode workspace. One is a static library and the other one use the static library.
In the static library I added the GDataXMLNode.h and GDataXMLNode.m files, which I use in the main project. The GDataXMLNode.h is a public file so it's visible in the main project. I also linked the target of both projects with libxml2.dylib. And I also include in the Header Search Paths and User Header Search Paths the location /usr/include/libxml2.
Although these, I get an Apple Mach-O Librarian Error:
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: can't locate file for: -lxml2
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: file: -lxml2 is not an object file (not allowed in a library)
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: file: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libxml2.dylib is a dynamic library, not added to the static library
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: file: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libxml2.dylib is a dynamic library, not added to the static library
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: file: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libz.dylib is a dynamic library, not added to the static library
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: file: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libz.dylib is a dynamic library, not added to the static library
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool failed with exit code 1
Do you know how can I fix this?
I had the exact same error recently. As you found, removing "-lxml2" from the "Other Linker Flags" in Build Settings helped resolve the errors. This is true when you are building a static library. You will need to include that linker flag ("-lxml2") in any target that actually includes your static library. For example, if you created unit tests for your static library as I did (i.e. MyStaticLibraryProjectTests) then you would need to make sure to add the linker flags to the MyStaticLibraryProjectTests target but not to the actual MyStaticLibraryProject target. More often than not I generally forget to select a specific target when I go to look at my Build Settings tab. I usually assume that if I click on the big blue project icon that the build settings are just for the entire project but it is very important to select the correct target when modifying those settings.
Early on most projects generally do only have a single target but as you get more advanced it is possible to have multiple targets for each project. Hope that helps.