I use this instruction and CMake tool. When I built XCode project created by CMake I had 2 .dylib files. When I add this tow libs and gtest_main.cc and gtest_all.cc in my existing project, compiler don't see #include "gtest/gtest.h" header.
How do I need to add google test to existing XCode project?
So, I just set the build parameters of my project's test target, as in the examples for gtest, and it works.
Sorry for the stupid question
Related
I'm trying to build a 3rd party C library and include it in my project. The library is the Swiss Ephemeris and I'm trying to use the preconfigured Xcode project here https://github.com/dwlnetnl/SwissEphemeris.
I can get the framework to build properly, but I don't know how to include it in my project. Ideally, I want to store the framework within the project so that I can commit it to a repository and have developers check out the file, and build the project without the need to have the framework installed locally first. I'm not sure if that's possible?
So, if someone can explain:
How to include the built framework into my project
How to 'embed' it
within the project so that the framework can be stored within the
project.
it would be greatly appreciated.
Static libraries are unsupported in Swift 1. You can use Objective-C to call the library.
I have a problem with setting dependencies in XCode 4 between separate projects. Currently, I have two projects in the same workspace. The first project have a Framework amongst it's products. I would like to use this framework in the second project, as a dependency for Bundle target.
First project build successfully. However, the second one claims that it cannot access headers from the framework, although it exists in there. I added the framework to Build Phases -> Link Binary With Libraries section of my target, but this does not help. I was looking for an answer, but all I found were suggestions to add library on the Summary page. Unfortunately, in opposite to Application targets, Bundle target does not have this pane. Is there any other place where should I add the framework?
This answer describes the current procedure for adding a library dependency, including headers: https://stackoverflow.com/a/9726445/382938
I don't understand the difference between these Xcode features.
I'm building and app - but the functionality of the app is being abstracted into libraries (so they can be distributed separately as an "SDK").
So I have a workspace of library projects and the app project. I can add library projects to the app project by doing "link binary with libraries". This gives me a list of .a library projects in the current workspace which I can link to.
I can also add frameworks here.
In the "target dependencies" bit all I can add is other targets in the current project.
What I really want to do is both - I want my app project to build all the other library projects when I build it. I also want to make it verbose what libraries the app (and other libraries) depend on.
So can somebody please explain the difference, and whether what I am doing is the right way to go about it?
Many thanks!
It says here...
Drag your framework product (located in the Products folder) to the existing Link Binary With Libraries build phase of your application
target. This causes the application to link against your framework.
And...
In the General tab of the inspector window, add your framework as a dependency for the application. Adding this dependency causes Xcode to
build the framework target before building the application target.
The build dependency you establish in the application target causes
the framework to be built before the application. This is important
because it guarantees that a built version of your framework will be
available to link against and to embed in the application. Because of
this dependency, you can set the active target of your Xcode project
to your application and leave it there.
So it seems that you're supposed to use both. Seems redundant though, because if you're linking to a framework then its a dependency. I suppose you might want to only link to a library and not build it first. Although Xcode seems to build linked libraries even without them being added to the dependency section. Perhaps that's a result of the "Find Implicit Dependencies" option in a scheme's build settings.
I do something similar and was explicitly setting the 'header search path' and 'library search path' in the final executable target. However this all depended on where the objects were being generated. Initially I had set this to be within the source tree (actually a sibling directory called build), however after changing the location of the Xcode DerivedData directory and telling it to build into that directory, the projects no longer built.
The final solution was simply to remove the explicit setting of the 'header/library search path' and set the target dependencies correctly. This resulted in the project building for debugging and archiving without issue.
I'm quite new to QtCreator, so perhaps I left my heart in eclipse-ville, but I can't for the life of me understand how I should be setting up a project hierarchy in QtCreator. I understand there is an option to create a kind of root project and then from there add sub-projects to it, which makes sense but it leaves me wondering whether or not this is necessary at the time of creating the project, e.g. can I just create a library in one project and reference it later by another project?
I've tried setting up a blanket type of project by creating a new subdirs project and then adding the main program as a subproject, but then how should I add my library project?
Ideally, I'd like to create one project as the main application and reference another project as a library. Help?
The documentation of Qt Creator contains two sections that may help you find the answers to your questions:
Adding Subprojects to Projects
Adding Libraries to Projects
EDIT:
You can find a really simple sample project here: QtSymbianDllExample. "It is intended to demonstrate how to create and use a DLL with Qt on the Symbian platform". It is a sample for Symbian development but that is irrelevant now, I do not have a Symbian phone. What is important is that it contains a root project (QtSymbianDllExample\qtssymbiandllexample.pro) and two subprojects (QtSymbianDllExample\qtenginedll\qtenginedll.pro, QtSymbianDllExample\testui_simpledllengine\testui_simpledllengine.pro) which you can examine and compare to you projects. I have checked that I can build the root project by doing the following steps:
Download and install the Windows Offline Installer from http://www.qt.io/download/
Download and extract QtSymbianDllExample.zip
Run Qt Creator
File / Open File or Project... Select qtssymbiandllexample.pro
Build / Run qmake
Build / Build project "qtsymbiandllexample"
I have a minor problem. Whenever I try to build my project using the distribution configuration it complains that one of my libraries is missing
ld: library not found for -lTouchCustoms
This only appears in distribution mode. The only difference between the release and distribution build is in the code signing section. Because of this I had to use the release build (with distribution profile code signing) to publish my app because that builds correctly, and was acceppted. If I delete and recreate the distribution config, duplicating the release config, I get the same error. How do I solve this? Thanks.
The problem is that the static library doesn't have the "distribution" build configuration. It will default to building the Release configuration instead. When the linker is trying to bring everything together, it is unfortunately looking in the "distribution-iphoneos" folder for the library while the library is actually in the "Release-iphoneos" library.
I'm trying to find a general solution for this issue in this question. For you and others it should suffice to simply add the same configuration to all static libraries you're linking against as well.