xcode c include files - c

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.

Related

mantaining compatibility between CLion and eclipse in C project

i have a question that google couldn't solve. thing is i am currently working in a project with around 15 other people. some of us use eclipse and some use clion. the problem is that clion uses a "CMakeLists.txt" file in which specifies all files to be compiled. Eclipse doesn't use this file, but the ones using clion complain that they have to manually add all .c files created in eclipse in that file in order to compile the project. is there a way to get around this? thanks

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.

GTK with C and Eclipse

I have decided to use the GTK library and I have been messing around with it.
My problem does not lie within C or GTK itself, it all about Eclipse. Even though my applications compile and run with no errors, but Eclipse is constantly telling me that there are problems such as:
GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE... could not be resolved.
Is there a way to make Eclipse understand what is going on?
I guess Eclipse cannot find GTK's header files. You can tell it where to look for them by adding one or more include directories to the project properties:
Project → Properties → C/C++ General → Paths and Symbols → Includes
This works for Eclipse Indigo and Juno, at least.

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

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.

Compiling C code as static library for use in iPhone app?

Pardon me if this is a "noob" question, I'm overextending myself a bit with this.
I'm trying to compile a library written in C for use in an iPhone app I'm developing. I can't seem to figure out how to do this, and I've been searching and trying things for hours.
I've tried using an External Build System project, and selecting the folder where the makefile.in.am.mingw are.
I've tried creating a Static Library project and adding the header\source files to the project. Which looked good until I tried to compile and got 260k+ errors.
When I 'cd' to the directory with the makefiles and type 'make' I get:
No targets specified and no makefile found. Stop.
I have no idea how makefiles work, I just want to use the library!
Is there a simple way to do this? If someone could at least point me in the right direction, I would be quite appreciative.
The makefiles you have are for GNU automake (under MINGW by the look of it). Even if you get them working (automake can be tricky, but it is included in Mac OS X's development thankfully), it probably won't help you much in building an iPhone library.
I did this with an existing C library by creating a new framework target in Xcode with the right include settings, etc gleaned from looking at the makefiles. That created a .framework bundle with headers and an iPhone .a library ready to be used by an iPhone project. You could also just import the C source into the iPhone project, and have it compiled in that way which would probably be quicker.

Resources