How to use custom dylib in library project in xcode 4? - c

I'm writing a shared library (dylib) in c using xcode 4.2 say X.dylib. In this project I need to use other very specific dylib, say Y.dylib. I want to keep it in the project and ship together.
Right now compilation of X.dylib fails unless I put Y.dylib in /usr/local/lib. But I want to have it in my local bundle/project.
How to configure xcode in this case?

In Xcode 4.6 you just need to drag your framework onto your Xcode project, and check Copy items into destinations groups's folder and check all targets you want to add the library to.

Related

Building a multi module C project (i.e. solution) with Eclipse CDT

I am moving from Netbeans to Eclipse (on Ubuntu 12.0.4). I have a C application that consists of several sub projects which are libraries (shared and static), as well as stand alone executables.
I can't figure out how to create a 'parent' project foo, which contains component projects
foobar
foofoo
barfoo
barbar
Ideally, I want all the 'component projects' to be created under the folder foo, so that I have a directory structure like this:
/path/to/foo/foobar/ (contains foobar project files)
/path/to/foo/foofoo/ (contains foofoo project files)
/path/to/foo/barfoo/ (contains barfoo project files)
/path/to/foo/barbar/ (contains barbar project files)
Does anyone know how I can achieve this structure using Eclipse as IDE (with CDT)?
Last but not the least, I intend to create my C modules using the Autotools option. Will the generated files for Autotools be automatically updated as I add new header/source to a module - or do I need to manually maintain the Autotool files?
Friend,
I think there is no the "parent" C project. You can create a normal C project in IDE and add all dependencies into sub-folders. Then tell compiler your build procedure via Makefile. I think it's easy way as you have had experience on C application.
About autotools, once you update/add/remove your project file, I think you need to modify your Makefile to reflect your change and do clean and rebuild your project.
For other C build tools, you can use buildroot if you'd like.
The best way I can think to do this in eclipse is to create a separate workspace for the project e.g. foo, and then add the sub-projects (foobar, foofoo, etc...) as projects. This is generally a better approach to take with eclipse, instead of a single monolithic workspace. I don't know what the specific dependency structure for the sub-projects looks like, but you should be able to express it simply by using eclipse project properties. This can include a rollup executable sub-project that depends on the libraries.
Unfortunately, I'm not sure if eclipse cdt will maintain autotools files. However if not, it should be relatively easy to integrate and use some of the autotools binaries such as autoscan, and autoheader into the eclipse build commands.
At first you need to a working directory, Then you should new project, Then per file or per class (according to C++ or C ) append your files, it's much safe way. another way is not clean, i have experience. don't use them.

Is is possible to load Qt dependant library (dylib) in MonoMac and how to do it?

I need to create a dllImport and some extern functions in a MonoMac project (C#). I added the library to the latest version of MonoDevelop with the Add Native Reference option to the project.
I then added the dllImport and the extern functions, I got an Exception saying the Dll was not found. After running a System.IO.File.Exists() on the path I decided to have a method to test loading the lib using Dlfcn.dlopen(), it returned 0.
Then I copied the whole framework directory inside my bin/debug folder (in my project folder) and created native references for each library in the framework. Tried to load libcrypto.1.0.0.dylib, it didn't work.
I started thinking that something could be wrong in the method I was using. Then I got my sqlLite 3 dylib, copied it and tried the same test and got a pointer with Dlfcn.dlopen().
What am I missing here? I normally would not like to have the whole Qt baggage in there but the native dylib I have to use, uses this framework.
Is there any way to get a reference to this dylib?

How to make Visual C++ solution to not remove one project when start build another

I've got two projects in solution, library and executable.
First I build library but then when I start build another project it cleans library even when library files is in different folder and should not anyhow conflict with it.
How to say to not remove library by building my executable?
If your executable depends on your library, the library will be automatically cleaned when cleaning or regenerating the executable.
It will not be cleaned if only generating the executable (not regenerating), which will only compile modifications since the last build.
If your executable does not depend on your library, the library should not be cleaned.
If this is really the case, you can try to build the executable by right clicking on the project located in the solution explorer.

cmake vs gmake for qtcreator project

I am attempting to use QtCreator as an IDE for a straight C project. The reason is that I am comfortable with QtCreator and I want a visual IDE for stepping through this new project I am working on. My development box and my deployment box are different, but both of those have gmake on them. QtCreator requires cmake, which I dont mind putting on my development box, but my deployment box is not going to have cmake.
Am I OK to build my software on the Qt box, and be sure it will deploy on the deployment box?
Edit: to be clear, the existing code base already has a makefile structure going, and I'd rather not interrupt that. If I can set my project up to use those existing targets and such it would be great.
If your project is using CMake as build system, then you should have it installed on the machine you are building. You can't pregenerate Makefile's and then just run make on the other box.
Well, you actually can, but then you will probably need same compiler versions, libs/headers located in same paths and etc. So generally it's not good idea.
As for deploying already compiled binaries - it have no relation to CMake. The general rule there is that you should have same shared libraries on both machines. Linking your project statically allows deploying single fat executable/library, without any additional dependencies.

xcode c include files

I would like to use XCode 4 as IDE for my C program.
I am using few libraries, which are not installed in system paths. Also, I am using external program for building (waf).
So, basically, I need XCode for everything, except building.
But I can't figure out how to tell XCode where my library include files are for it to be able to autocomplete functions and everything from that libraries?
In the build settings for the Target - look for the HEADER_SEARCH_PATHS setting.
Have you added the library headers to the project? You can just add them by reference.

Resources