Can't link static library in XCode 4 in workspace - iphone

So, I'm working on a project and can't get my XCode 4 workspace to behave. I have the main application as one project in the workspace. I then add the static library project into the workspace. It seems like everything is working okay. I can import files from the other project. It builds, but when I run it, I get this:
dyld: Symbol not found: _OBJC_CLASS_$_iGBC
Referenced from: /var/mobile/Applications/CD00CC83-28E4-4467-96C0-0D1777E21FDA/GBA4iOS.app/GBA4iOS
Expected in: flat namespace
in /var/mobile/Applications/CD00CC83-28E4-4467-96C0-0D1777E21FDA/GBA4iOS.app/GBA4iOS
And crashes. It appears that although Xcode believes the library has been linked, and it builds and runs, the app doesn't actually have the library. But in the derived data folder, it looks like everything that should be there... is there.
I'm going insane with XCode and all it's nuances in settings. Are there sanity checks I can go through to ensure this is working properly? What else can I do?
Edit:
Project settings are valid, and I've already linked the libraries.
Edit 2:
My workspace is setup so the libraries are also in the workspace:
I have removed the lib.a file from the main project and removed it from the Build Phase section, and added it back numerous times. There is no "copy library into destination folder" option when adding it in this way, so I can't do that.

try clean your build, if it don't work, remove the library in build phase and your project folder. When adding the lib to your project, check "copy item to destination if needed", the add that lib in build phase.

Related

Compile Adobe Flash Builder project with Flex SDK command line

I have inherited a Flash Builder 4.6 project, but cannot get the Eclipse FB to compile the project, and now my 60 days has lapsed.
I got fed up with being sent in circles by Eclipse/Fb and now I want to try and sanitise/understand the process by building manually using Flex SDK 4.6.
Trouble, is I do not know where to start. There is the MXMLC.exe and CompC.exe, there are projects within the workspace with inter-depedencies.
Simple example using ANt exists where the chap is only compiling from a single source file.
In my workspace I have a main project folder with sub-folders like src containing .as, .mxml, .png files and sub0fodlers like "assets". At the src root folder there is the main mxml which maps to the final compiled exe.
The project also has a "libs", "bin" "bin-release" folder.
The referenced projects are similar.
One of the referenced projects is "flerry".
I want a single Windows Perl/BAT scipts that will compile this for me.
Any ideas on where to look?
mxmlc.exe is used to compile the application, compc.exe is used to compile libraries. If you have code library dependencies, you'll first need to compile these and then compile your application.
The documentation on compiling is pretty good and can be found here: http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7fcc.html
I would suggest you give this a go and post specific questions if you run into issues.

Xcode Building from non-existant Project File

I'm building my project and I get a build error from within a file that is not part of my project. The file is not listed in the project navigator or in compile sources under build phases.
I've cleaned and run many times, same result.
How do I remove this file?
The problem is in the header file, not in the implementation file, something in your code imports that header, remove that statement.
This happened to me too. The fix for me was simply to restart XCode.
I think the issue came from me renaming the class and XCode must've cached the old name.

How to build ZBar SDK with the project instead of using the static library?

I am building an iOS, code scanner project using ZBar SDK. I am trying to build my project directly from the source of ZBar, rather than including the libzbar.a static library.
I have downloaded the ZBar source which includes the XCode project to build libzbar.a. I tried copying all source files from the project but it didn't work. I keep on getting undefined symbol errors.
What source files should be included, considering that I need to support only iOS?
Should the folder structure be strictly followed to build the project?
Would there be any need of build settings if I direcly include the source files?
EDIT:
I followed the same folder structure and build settings used in the XCode project of libzbar. I have managed to build the library but it's still failing while linking. I get the error: ld: duplicate symbol _OBJC_METACLASS for all the source files. I have double checked, there are no references to the original libzbar.a static library in the project or more than one occurrence of these source files. If I remove the references for them, the project builds fine, but then fails whenever any symbol from the library is referenced. I think I am still missing something!!
I have solved this problem finally. Here are the steps that I did:
1) Copied the source files of the project to my project.
2) Removed the dependency of libzbar.a from my project.
3) Added the path to the folder containing the source and headers to the Header Search Paths build setting of the project.
4)Added the following user defined build setting to the project:
EXCLUDE_SOURCE_FILE_NAMES
GCC_MODEL_TUNING
PREBINDING and
USE_HEADERMAP
You should create the static library your self from the source code then add the output static library to your project, or link the projects together and force a build of the static library before your project is build.
After downloading the zip file from the default Mercurial repository and opening the file in xCode, click on the "EmbedReader" part of the target selection drop down box and switch to "zBarSDK"
Once you switch to the zBarSDK, just build from the product menu and you should have your static library file....
I used ZXing lib before and it integrated well. It was included as a project and main project has target dependency to build it before main project. I edited it's sources for my needs and have no problems working with it.
I used this tutorial. It can be helpful for your needs too.

Reconfiguring a dynamic library

I'm working with an open source library that's made available as a git repository (XML-RPC) and I'd like to use it in an iPad application. As I understand it, iOS applications should use static libraries for their linking.
Since this comes as a dynamic library, how can I convert it to something I can link with my app and use?
Maybe naive answer but why not just add all the relevent files in the repository to your app and just build it?
Put the files in a seperate folder obviously so you can update them to a newer version if you need to etc. Lots of projects I've done have an 'external' folder that just contains codethat I use from 3rd party sources. I've usually got the source so just compile it into my app and don't bother with making it a library.
Or are there tricky conditions that need to be met to compile this code?
I ended up doing this in several steps:
First, I opened the library project in Xcode and created a new target for the static library. I then made a directory in the project folder called "XMLRPC" and moved all the header files to it. I deleted the now-red invalid references to the header files, and re-added them (but kept the box for copying them to the current folder unchecked).
I added this Xcode project to my main project with a relative reference. I opened my main app's target and added the library project as a direct dependency, and checked the "Always search user paths" option on my main app's target settings.
Lastly, I modified the general Xcode preferences to use a shared build directory. I haven't tried it without that since it was something I wanted anyways; it might not be necessary.
My revision control has two folders in it: one's my project, and the other's the library. The library is still under git control within mercurial; I'm hoping this doesn't cause any issues.

Iphone Link Static Library

I have created a static library in XCode called TestLib.
I then created a simple test project that will use this library. I dragged the TestLib xcode project into my test project (frameworks section - if it matters), and set TestLib as a direct dependency of the test project.
I am having trouble importing header files from the Library, I only have 1 in there (its a test project) called TestLibHeader.h, but no matter how I attempt to import them, I get compile errors stating that the header file cannot be found.
Where am I going wrong?
You need to tell your build target where to look for the header files for a given build configuration.
in XCode 3.x
Double click on your build target.
Click on the Build tab.
Search for the build setting Header Search Paths
Set Header Search Paths to include the path the header files in your library project.
See the instructions for setting up three20 as a dependency for a good example of these steps in action.