How do I include Scintilla in an XCode 3.2.5 project? - objective-c

I downloaded Scintilla, built and ran ScintillaTest. That worked (almost) fine. Now, I want to include Scintilla in a new project, but can't seem to figure out how to. I tried ctrl-clicking my target and selecting Add Existing Framework..., then Add Other... and finally file located at scite337/scintilla/cocoa/ScintillaFramework/build/Release/Scintilla.framework (obviously I omitted the first part of the path).
After I did this I just added an #import statement in the AppDelegate of my further untouched new project. Upon hitting Cmd+R it says ScintillaView.h: no such file or directory...
I thought that if I added the framework to my only target it would pass the location of the header files to the compiler (and preprocessor). Obviously it doesn't, so I assume I'll have to add the paths of the header files (and maybe other files) to the Build Settings, but there are lots of Build Settings, so I don't have a clue where.
If you don't have access to XCode 3.2.x, please leave how you'd do it in a newer version. I've found a lot of information on other XCode matters for higher versions did that work well in XCode 3.2.5 too (with a little bit of searching for menu items and settings panels).

By looking at the ScintillaTest XCode project I discovered how it works: you have to import the XCode project called ScintillaFramework, which is the file named ScintillaFramework.xcodeproj (obviously). But that isn't enough, after that XCode still can't find the header files in the framework. I looked at the build settings in the ScintillaTest project and found 'Header Search Paths' set to ../../. Setting this failed in my project, it had to be one directory less back: ../. No I just need to get the compiler to accept the C++ constructs in the Scintilla framework.
Update:
Strangely, this stopped working. I do not understand it either. So I just right-clicked my target, from there: add existing framework...->add other...->[browse to ScintillaFramework/build/Release/Scintilla.framework]. This works partially, see my newest question.

Related

Framework not found, when it is clearly there

I want to try out Scintilla (in Cocoa), but XCode does not cooperate. I included the Scintilla framework at scite337/scintilla/cocoa/ScintillaFramework/build/Release/Scintilla.framework by right-clicking the target in XCode and selecting Add Existing Frameworks.. and then Add Others.... This seemed to work, suddenly the compiler seemed to find the files because the files produced some parser errors (so it has to get compiled, right?). But after I solved these errors, I got a knew one:
Framework not found Scintilla
Command /Developer/usr/bin/llvm-g++-4.2 failed with exit code 1
I did verify if the Target Membership of the framework was set to required and it was. I tried to set the header search path to the path of the framework as well, but that gave the same error. I have no idea how to proceed from here.
XCode 3.2.6, Mac OS X 10.6.8

106 duplicate symbols for architecture armv7

Working on my iPhone app and trying to build for debug and I get "106 duplicate symbols for architecture armv7"?
I am using the .workspace file because I am trying to use CocoaPods. If I don't use the .workspace and instead use the .xcodeproj I don't get the error, but then I get missing -lPods .
In my project I have the following targets in the Project Navigator.
Pods (blue icon)
MyProject (blue icon)
Restkit.xcodeproj (blue icon)
... all my files
The issue is that Restkit is making reference to "AFHTTPClient.h" and all the other AF code, but I included it via CocoaPods. I tried deleting the AFNetworking folder from the RestKit library, but apparently the Restkit library can't find the Pods version of AFNetworking?
Is there a way to get RestKit to use the Pods version? If not how do I go about removing Pods from my project?
There is a line in one of your .h files where your wrote
#include "___.m"
instead of
#include "___.h"
So I fixed it. After removing the RestKit version of AFNetworking, from the vendor folder, I added it back by dragging into Xcode. It asks which project I want it used/copied to and this time I selected RestKitTest (or whatever the RestKitTesting is named). It works now. Maybe I selected both RestKit and RestKitTest before, which was wrong?
I also came up with same error. Generally this kind of error occurs due to duplicate classes and xibs in project folder. For Example in my project I had these classes twice ServiceRequest.h/.m. Get rid of duplicate ones and you are good to go.
In Build Phases -> Compile Sources, make sure you don't have the same file added twice.
"Duplicate symbols for architecture" issue occurs in two situations:
You added a .m file twice into your project
You're using a static library (.a file) which already includes some classes that you include into the project.
For fixing any of those cases, check the linker error and look for the .o files that are duplicated (sample: Reachability.o).
Then go to the build phases -> compile sources and search the specified files, if any one appears twice delete one of them, if only appears once it means that the file is also included in one of the static libraries added to your project. Delete it from your list of sources to be compiled and try again.
I saw this error when, I did drag and drop my calabash framework onto xcode and selected add to targets option in the window thats shown. Basically there were two references to files added
I had to remove the calabash framework manually
Right way of doing it
copy to calabash framework to project directory
then go to xcode project
Choose target -> Build phases -> Link Binary With Libraries and add the frame work using + button
I have noticed that duplicate symbols are caused for Google analytics after installing cocoaPods as well. Once I removed one of archives, either libGoogleAnalytics_debug.a or libGoogleAnalytics.a duplication has gone. But obviously if I removed debug one I will not be able to run os simulator and vica versa. I know its not the solution, but at least it could give an idea what could be a solution. Will come back to this thread if I will figure out how to have both a files in this case.
Edit:
I was able to solve the issue by upgrading from G analytics version 2 to 3. It has only one library file and I guess this is the reason why we don't get duplicated symbols anymore. I hope it makes sense.

Framework header not found in Xcode 4.2 but application runs fine

I have a Mac app that uses a framework.
In build phases, I've added the framework to Link Binary With Libraries and created a Copy Files build phase to copy the framework. Furthermore, I'ved added the framework search paths to Framework Search Paths, Header Search Paths, and User Header Search Paths. The path is as follows:
../UMEKit/DerivedData/UMEKit/Build/Products/Release
I can build and run the application however next to the header import statement #import "UMEKit/UMEKit.h", there is a red maker indicating that the header is not found.
I've also tried restarting Xcode and my computer a billion times and haven't been able to resolve the problem.
Any suggestions on what I might be doing wrong?
Do not use quotes when importing something from a framework. Use <> instead. For example
#import <UMEKit/UMEKit.h>
This will work.

How to install CorePlot framework correctly?

I want to use CorePlot.framework in Mac OS X. However, I cannot install it correctly though it has costed me several hours.
I downloaded it (0.4 version) from google host site, and have tried to put CorePlot.framework in "/Library/Frameworks/" or some other custom places.
I also have added it into "link binary and libraries". unfortunately, the compiler always cannot find "" .
Any one who have some experience can give me some advice to install and use it?
If you check the readme files, you can find the instructions as follows:
Copy the CorePlotHeaders to your Xcode project
Copy libCorePlotCocoaTouch.a to your Xcode project
Add to Other Linker Flags in your target build settings: -ObjC -all_load
Add the QuartzCore framework to the project.
To follow these instructions, create a new blank project and copy the folder (drag and drop) CorePlotHeaders into Xcode. When prompted, be sure to check "copy these files/folders to the source directory".
Next drag the libCorePlayCocoaTouch.a library in the same manner (again, select the checkbox). You should now have the .h files and the .a included in your project.
Now, select your project and choose the "Target" and in the 3rd tab "Build Settings" search for "Other Linker Flags" and add -"ObjC -all_load" without quotes.
Finally, add the QuartzCore framework to your project and you're done.
I've been working with CorePlot today and am rather impressed with it so far. It's not 100% comprehensive but it's good enough for what we need. If you get stuck, be sure to follow the readme instructions and double check everything is setup as needed. I didn't struggle with getting it set up unlike some other libraries so hopefully you should be able to get sorted with minimal fuss :)

Compile, Build or Archive problems with Xcode 4 (and dependencies)

This question has evolved over the past several weeks to cover more general issues with xcode4 (and upgrading projects form older xcodes).
However many of the issues can be solved by following the same set of instructions.
If you have any of the following issues, try the methods in the accepted answer:
Xcode 4 fails to archive an App
Xcode 4 creates an unusable archive
Xcode 4 does not create an .ipa
Xcode 4 fails to compile due to preprocessor errors
Xcode 4 cannot find headers
Xcode 4's code complete is not working
Project dependancies won't compile
Adding a dependancy causes any of the above issues
Original Question
Title: "lexical or preprocessor issue file not found" in Xcode 4
I have a project in Xcode 4 that will build fine and run on the device and simulator but when trying to Archive it errors when looking for headers files associated with a static library:
In file included from /Volumes/Development/Path/LBProject/LBProject/LBProject-Prefix.pch:15:
In file included from /Volumes/Development/Path/LBProject/LBFDefines.h:23:
In file included from /Volumes/Development/Path/LBProject/Classes/LBProjectAppDelegate.h:11:
In file included from /Volumes/Development/Path/LBProject/LBProject/../FKNDirectory/FKNDirectoryManager.h:10:
/Volumes/Development/Path/LBProject/LBProject/../FKNDirectory/FKNDataModel.h:11:9: fatal error: 'Merchant.h' file not found [1]
#import "Merchant.h"
^
1 error generated.
Xcode gives the error
lexical or preprocessor issue file not found
Much Googling has show many people are having this issue but no solution. Anyone got a fix or even a clue.
Update: The user header search paths are set to ${BUILT_PRODUCTS_DIR} in all configurations. It builds fine using any configuration except when archiving.
Update 2: Merchant.h is a Core Data class that is auto-generated and therefore inside .xcdatamodeld package, however the headers are all copied to the public headers directory when the library is built.
NB: The steps below will solve 90% of your Xcode archive issues
however, from the comments it is suggested you try quitting Xcode
first. This may save you hours of setting tweaking.
Check the "user header paths" are correct (Add "" to paths for spaces, both in your project and dependencies)
Set "Always search user paths" to YES
Create a group call "Indexing headers" in your project and drag the headers to this group, DO NOT add to any targets when prompted. This includes any headers inside your .xcdatamodeld, you'll need to right-click and view package contents to find them.
For all dependencies set "Skip Install" build setting to "Yes"
Moving any "Public" headers in Build Phases to "Project"
Set the Build Setting "Installation Directory" on your Target to $(LOCAL_APPS_DIR)
Change the target build setting "scan all source files for includes" to YES. (link)
With newer versions of Xcode (> 4.2) you might want to read this question related to workspaces.
Manually delete the project.xcworkspace files form all referenced projects
I had the same problem in XCode 4: "Lexical or preprocessor issue MyFile.h not found". However, MyFile.m was not a static library, just a standard class. And MyFile.m and MyFile.h were included properly and indexed in the project.
So ... I quit XCode and the Simulator, then restarted them and the problem disappeared.
I found that the problem went away when I changed the target build setting "scan all source files for includes" from no to yes.
I was able to resolve this issue without any changes to any of the build settings by simply copying the .h files into the Project's directory in the finder. I did NOT add them to the project at all. Just having them in the project's filesystem directory seemed to be enough to allow Xcode's implicit linking to work properly. More details here.
I had a weird issue like this. Changing "Scan all resource files..." to Yes didn't help. I took a look at the Framework Search Paths and noticed that I had
$(inherited)
"$(SRCROOT)"
"$(SRCROOT)/my/correct/path"
It seemed right but was still failing. I then tried rearranging the order of 2 & 3 and all of a sudden it built fine. So not sure why that was the hickup, but wanted to add it to the list of things to try in case it helps someone else.
My solution was to change my
#import "HeaderFile.h"
to
#import <FrameworkName/HeaderFile.h>
and everything started working again.
What was unusual was that it had stopped working suddenly after building
a few times.
The problem resolved itself when I set
Build Settings->Project->Search Paths to Yes
I had the same — 2 targets in my project (Project and ProjectTest of GHUnit). When my scheme was set up to Project, the import of <GHUnitIOS/GHUnit.h> was problem of “lexical or preprocessor issue file not found”. But when I set as a scheme ProjectTest, everything was OK. So, I have added GHUnitIOS.framework in Project too.
Looks like your header search paths are incorrect not configured properly in your build settings for the active scheme. Verify them and update your question with the current setting.
I'm having similar issues on the simulator but not the device and my header search path fields are empty (Seems to be default). But changing Workspaces seems to have solved the issue. Maybe you could try creating a new Workspace, add your project to it and see if that helps. Now I'm investigating why.
I was getting this "file not found" error for one particular .h file in my project. I resolved the issue by removing that .h file from the project (selecting "Remove references") and re-adding it.
Adding on more variant: I had two instances of foo.m in the Compile Source build phase, which some how caused "Header not found" for foo.h.
Another chance:
In workspace project: watch in the Target for section Build Phases. As many manuals says you need to have a Copy Files Build Phase to copy all your headers to another place, as iOS Framework cannot contain header files to be shared (this is my case).
Choose for those Copy Files as Destination option "Products Directory". Or another directory of your like where the headers will reside.
That worked for me. Probably the build for Archive (or Release) directory is very different than expected in build for Debug .
Also check in your workspace settings your build directory.
XD
For me, this issue occurred after I added new files to the project; a blank .m and .h derived from NSObject. Here's how I resolved it:
Closed and restarted xCode
Deleted the two new files via XCode
Recompiled successfully
I then Re-added them afterward and it also worked.
Definitely a bug in xCode...