Adding dependent project in XCode 4 - objective-c

I am trying to add a dependent project in XCode 4. The link to the project is this: https://github.com/jverkoey/ObjQREncoder
The author described a way to add this but it's for XCode 3. I am trying to add it to XCode 4.
I dragged the project inmy frameworks, then went to Targets and QREncoder in Target Dependencies. Then I added libQREncoder.a in "Link Binary with Libraries". Then I added this for header search path "src/Classes".
When I include "QREncoder/QREncoder.h", it gives me this error: file://somePath/FINALQRAppDelegate.m: error: Lexical or Preprocessor Issue: 'QREncoder/QREncoder.h' file not found
This is how my project is set up:
FINALQR is my project to which I am trying to add the dependency and the dependency project is in src.
Thanks.
The problem is it doesn't recognize the QREncoder class.

Only Xcode 4 workspaces benefit from shared build folders across multiple projects. From the main menu, select File > New > New Workspace... Save the workspace, then drag your subprojects into its Project navigator panel.
Be careful where you place them (make sure you're not making one project a subproject of another within the workspace) so that they're all top-level projects within your workspace. This will cause them to share the build folder and automatic dependency detection should work.
Unless, of course, you have custom search paths set in your targets' build settings. :-)

I think your problem is you need to set the following as your search path:
"$(SRCROOT)/src/Classes"
not
"src/Classes"
If you already have an Xcode4 project, you should be able to drag QREncoder into it as a subproject, as I think you have already done, and then add the .a file, also as you've done.

Related

How to define dependencies between targets in a TemplateInfo.plist file in Xcode 6?

When creating a TemplateInfo.plist file to define an Xcode project template that contains multiple targets, it used to be possible to use the Dependencies element of a Target within the TemplateInfo.plist file to create a dependency between that target and other targets.
With the intro of Xcode 6, the TemplateInfo.plist Dependencies element seems to either have been removed or is broken. Target dependencies are no longer created in the resulting Xcode project template, and even worse, including the Dependencies element seems to corrupt other elements contained within the same TemplateInfo.plist file.
Has anyone figured out how to define a target dependency within a TemplateInfo.plist file under Xcode 6?
Before answering, please note that I am not asking for the steps to manually create a dependency between targets in Xcode. I am asking how to do it within one or more TemplateInfo.plist files.
Thanks.

Adding .c files to xcode

I'm trying to add the hypen library to my Xcode iOS project and it has 4 files: hyphen.c, hyphen.h, hnjalloc.c, hnjalloc.h. I dragged them to my project and hit build, but I'm getting undefined symbols for architecture i386 errors. Am I supposed to take any other steps besides dragging them to my project?
Make sure you've added them to the build target - including a file into the project without including in the build target can easily cause this error.
right click on the Source folder (top left where all the folder are) and check add. Then choose the files you wish to add. I tried drag&drop had problems with linker.

Populating the configuration to the nested library project

I have a main project, which includes a nested library project which produces a libCore.a library.
Both of the projects have the two configurations debug and release. Now if I build the main project with a given configuration, how can I make sure that this is passed down to the library project as well?
Make your project directly dependent on the libCore project. Do achieve this, do the following:
Drag the libCore project file to your main project. It happens sometimes, that only the xcodeproj file is moved. If this happens to you, restart XCode (this happend to me with RestKit and the latest XCode).
After point 1 is done and you can browse the dependency project, go to your target build phases and add the libCore as the target dependencies.
Link against libCore.a by adding in the Link Binary with Libraries phase.
These are 3 basic steps, I don't know what the libCore is, if it needs to be linked with any other libraries then you will also have to link your target against those libraries.

‘QRootElement.h file not found’ error when building an Xcode project that uses QuickDialog

I would like to use QuickDialog but I can't use it without errors.
Here's what I did:
Drag the .xcodeproj project in to my Xcode 4 project. The default options 'Create groups for any added folders' and 'Add to targets' was selected
Selected my project from the Xcode sidebar and then the target I want to add QuickDialog to.
Selected the Build Phases tab.
Under the Target Dependencies group, clicked the plus button, select the QuickDialog static library target.
Under the Link Binary Libraries group, clicked the plus button, select libQuickDialog.a.
Added "$(SOURCE_ROOT)/Build" to the target's Header Search path.
Added "-ObjC" in Other Linker Flag
Now, if I build (cmd + b) everything works! But if in my own code, I add, for instance:
#import "QRootElement.h"
I get a lot of errors:
'QRootElement.h' file not found
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1
error: unable to open executable '/Users/myUser/Library/Developer/Xcode/DerivedData/SaGASForm-gvoiwjscornqdcfjxbxtdjcwxnwq/Build/Products/Debug-iphoneos/ProjectForm.app/ProjectForm'
My project has been set to use ARC with LLVM 3.0.
What am I doing wrong?
The problem seems to be that your XCode project can't find the header files in the subproject.
in step 6, you're probably not linking to the proper directory with the header files.
There are detailed information on how to add QuickDialog to your project here: http://escoz.com/open-source/quickdialog

Xcode won't build IB plugin into resources folder

I've created a custom control and a framework/IB plugin for it using the IB3 plugin template.
According to the docs the plugin should be built right into the resources directory of the framework. When I build my project the plugin is in the configuration folder (Debug) along with the framework instead.
This is the same behavior right out of the box when I create a new template. I tried changing the CONFIGURATION_BUILD_DIR to be $(BUILD_DIR)/$(CONFIGURATION)/FrameworkName.framework/Resources/ but got no change.
For grins I also tried messing with the install path, but also got nowhere. I've checked out a couple other open source projects to check their build settings, but they're identical to my own and yet their plugin is built and put into the resources directory as expected.
Don't mess with build settings. Instead, add a "Copy Files" build phase to the framework target. In the inspector for the copy files build phase, set the directory to "Resources". Add the plugin to this build phase by dragging the plugin product from the "Products" group in the "Groups & Files" tree in Xcode.
To get the built product of one Xcode target to be included in the resources directory of another Xcode target's product, you should find the product in the groups and files tree and drag the product into the copy "bundle resources phase" of the other target. You should also add a target dependency between the two targets with the get info panel for the target.
If you're seeing the built plug-in in the build products directory that does not mean that it wasn't also copied into the framework's resources directory. Xcode builds all targets into the build directory, and then copies (not moves) them into their final destination - which in this case is the framework's resources directory. One reason for this is that a product can have multiple final destinations.
Thanks, Barry. When I tried using a copy files build phase, IB wasn't able to resolve the connection between the framework and the plugin. It couldn't find the associated plugin for some reason.
However, after endless fiddling, I found that I was closer than I thought. Changing the CONFIGURATION_BUILD_DIR to:
$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/FrameworkName.framework/Resources/
and updating the framework search paths solved the problem for me. This isn't the behavior of the plugin template (at least on my machine) out of the box, so hopefully this will help someone else.