How do i add libraries to CodeLite projects? - libraries

I recently started using CodeLite since i though that it would be a great software, but i don't know how to add libraries to projects.
Can anyone help me out ?

but i don't know how to add libraries to projects
Assuming that you want to compile and link against some external libraries, these are the steps you need:
Open your project settings (right click on the project->settings) -> Compiler -> Include Paths, and set here the location where the compiler can find your .h files
Open project settings->Linker->Libraries search path and place here the location where the linker can find the libraries (usually suffixed with .a, .dll, .so)
Open the project settings->Linker->Libraries and set here the library name, for example libMyFirstLib.a;libMySecondLib.a etc
You can find more info here:
http://codelite.org/LiteEditor/ProjectSettings
The screenshots are outdated, but the names / fields are the same

Related

How to construct a Swift Package that links to a local (not system) library?

I must have read over a dozen posts on possible techniques to link a local library into my Swift Package. Specifically, my package depends on libturbojpeg.a, which most users won't have installed anywhere. Even if they did install it (there is a DMG), I'd have to go through hoops to make sure I was linking in the correct version. I finally found a post in the Swift Forums that basically says you can't do it now.
It appears that the only way to link it now is using .linkerSettings(LinkerSetting.unsafeFlags(..., but if you use that your package can't be managed by Xcode (see above link, and I even tried it and verified it cannot be used).
Is there some kind of workaround that allows me to distribute my Swift Package with the library?
In my Package, I created a directory "Libraries" and added my library there.
I discovered that Xcode 11 places included Swift Packages in a specific location in the Derived Folders directory. This means that it is possible to tell Xcode where to find it during the link phase.
My Package has these instructions in it for users:
1) Add the Package using Xcode->File->Packages with the URL of https://github.com/dhoerl/
2) Open the app's Project Build Phases, and from the Package shown in the left file pane, drag the Libraries/.a file into the link phase. It will appear just above the that should already be there
3) In Application Build settings, under library search paths, add:
"$(BUILD_DIR)/../../SourcePackages/checkouts//Libraries"
Build and run! VoĆ­la - works like a charm!
Note: obviously this is somewhat fragile, Xcode 12 could change how packages are managed, but its possible by then that the Swift Package Manager will support linking of local libraries (its mentioned in the above link.)

How do I include a framework in my xcode project if I want to send it as zip

Sorry this is somewhat a silly question, but I could do with some help with this.
Basically my app uses various Google Frameworks (maps, places etc). But when I compress my project and send it it stops working. I've included all the frameworks in the root folder of my project, here's the errors i'm getting:
Now when I look in at the framework in the left panel of xcode, it appears like this:
The headers have gone!
Here's how it should look:
Why is this happening?
I believe this is because your framework's directory isn't referenced properly. Go to your target -> Build Setting -> Search Path -> Framework Search Path and fix it accordingly.
However I would recommend you use a package manager like cocoapods as it will allow others to download all the frameworks necessary separately, and also it will allow you to easily update the frameworks to its latest version.
Have you done this while adding the framework?(like the image added)

Trouble with an .h import

As a beginner in ObjectiveC I need some help.
I'm working on a phonegap plugin for IOS (so, written with objective C). I use some open source code but I got an error with an .h import.
My architecture look like:
myFmk.framework/
myFmk.framework/ABCDE/myFmk.h <== in a sub folder
myFmk.framework/myFmk <=== this is a file
myPlugin.h
myPlugin.m
In myPlugin.h I have #import and in "myFmk.framework/myFmk" file I have only one line "ABCDE/".
I thought that this file do a redirection of the absolute import (with brackets) but my complier told me that "myFmk/myFmk.h" is not found.
I tried to find some documentation about this feature but I wasn't able to find its name... do you have this documentation or the feature name?
Thks.
Is the framework added using a cocoapod? If not, did you follow the instructions properly for adding it to your project? It would probably help if you posted the framework you are experiencing problems with.
If this is a framework that is added to your project properly and you are unable to import there are a few things you should check. First, go to your project settings (click on the project at the very top of your file tree in the left column) and then look for "linked libraries". See if the library is listed there. If not click the + and try to add it.
If this framework was added via cocoapods another thing to check is search your file structure for libPods.a. If it is red, I find sometimes it is helpful to delete it, close the project and run pod install again.
Also if you installed the project via cocoapods remember to open the workspace and not the old xcode project file.
I have also experienced this problem when my header search paths and other linker flag paths were wrong. Linker Flags should be $inherited if this is a cocoapod. In my projects most Header search paths are $inherited too.
If none of this is helpful please provide more information such as how this framework was added to your project and what the framework is. Also let us know if you get any error messages.

finding the framework of a cocoa modules

I just followed a tutorial https://medium.com/#PyBaig/build-your-own-cocoa-touch-frameworks-in-swift-d4ea3d1f9ca3 for creating your own cocoa touch framework. There is one step where you need to right click a framework and it shows in finder, but it is not working for me. I can right click any other file and show in finder just fine. Any suggestions on how to find the framework file for dragging into another project?
well according to some apple doc I found:
Note: The standard locations for frameworks are the
/System/Library/Frameworks directory and the /Library/Frameworks
directory on the local system.
If it isn't in those directories, it is probably some custom path that would be specified on the CC line in the build output, and if you were really hard up, you could click the diff editor on the Xcode project and search for something.Framework, where something is the framework you are looking for.
... it is also possible that it is a framework that is build by a sub-project, and for whatever reason, it haven't been built yet.

Build a static library for iOS - specifically spatialite

First, please forgive and point out if I am to use some other protocol for referencing another thread/post.
There was a previous thread how to compile spatialite for iOS where the top answer partly described building spatialite as a static library for iOS. The answer included the text:
"Once you've drag n drop the .a (both are required to work in the simulator AND on the real hardware), you can initialize spatialite by just invoking spatialite_init(1)."
I am guessing this is translated to some version of the following?
Xcode 4
File->New->New Target->iOS->Framework & Library->Cocoa Touch Static Library
Name the library - libSpatialite_TedS
Drag the header files to libSpatialite_TedS -> Copy Headers (question here ... there is a spatialite.h file in the 'headers' directory of the 'spatialite2.3.1.zip' download. Then in the subdirectory 'spatialite' there is another spatialite.h that is not an identical file and is obviously needed. Do we just drag the header files from 'headers' directory, then drag the directory 'spatialite' as a directory into 'Copy Headers' area of our Xcode static library 'myNewLibrary'?)
Drag the '.a files' libSPATIALITE2.3.1_arm.a & libSPATIALITE2.3.1_x86.a
Shouldn't we have some '.m' files to go with these headers in the 'Compile Sources' field?
Now, without referencing the libSpatialite_TedS in my project, when I 'Command-B' to build, the project build succeeds. However, when I look for the compiled product in
/Users/Admin/Library/Developer/Xcode/DerivedData/MyProject-gutnkbwqqonzgxbcmfzzzkadqhid/Build/Products/Release-iphonesimulator
I see build's products, but they do not include libSpatialite_TedS.
Is this because the compiler is 'smart' and recognizes that none of the header/.a files are referenced in the project so it does not bother compiling them?
And, is this the correct way to go about achieving the objective of the original poster how to compile spatialite for iOS?
Many thanks,
Ted S
I was running into linker errors with the original poster too, but solved it by including libsqlite3.dylib, libstc++.dylib, and libiconv.dylib in the target.
Hope this helps!
Ted, I believe that the .a (static library) files and headers are meant to be used in a project right away, rather than in another static library as you've described. They are the result of a project's output. I think you can find the project that built them, here:
http://lionel.gueganton.free.fr/spatialite/
And a little more on static library files:
What is a .a (as libcrypto.a) file?
EDITED
Here's another link that you might find helpful. It s a summary of the Static Library build process in iOS:
http://www.icodeblog.com/2011/04/07/creating-static-libraries-for-ios/

Resources