Eclipse

So

How we can configure and run programs on Eclipse.

here are details....

Eclipse IDE for C/C++ Developers can be downloaded and installed on linux environment.

Now its like an useless tool.

you can not run many of good programs which needs some extra libraries just more than GCC.

so follow the steps ...carefully...!!!

add following to paths...........

Right click on your project and select Properties

Select GCC C++ Compiler -> Directories

On the right, there will be an "Include paths" area. Click on the add button and add the following directories:

/usr/include/cairo

/usr/include/atk-1.0

/usr/include/pango-1.0

/usr/include/gtk-2.0

/usr/include/glib-2.0/glib

/usr/include/c++/4.2.3

/usr/include/glib-2.0

/usr/include/freetype2

/usr/include/libpng12

/usr/lib/glib-2.0/include

/usr/lib/gtk-2.0/include

/usr/lib/libxml2.so

/usr/lib/gtk-2.0/include

/usr/lib/glib-2.0/include

Next, select GCC C++ Linker -> Miscellaneous and add

/usr/lib/libgtk-x11-2.0.so to the Other Options (-Xlinker [option]) pane Compile and run your program

* Create a new 'C Project', Project type 'Executable', toolchain 'Linux GCC', selecting defaults for all pages

* Once the project is created, right-click on the project name and choose 'properties' (Alt-Enter)

* Expand the C/C++ Build menu and select 'Settings'

* In "GCC C Compiler", change the 'Command line pattern', add

Code:

`pkg-config --cflags --libs gtk+-2.0`//( backwards single quotes are important)

after Code: ${COMMAND}

Example Code:

${COMMAND} `pkg-config --cflags --libs gtk+-2.0` ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}

* Do the same in GCC C linker

and

Here's a way to do what cro (above) has done but a little more elegantly and easier to use and remember.

In eclipse

window->preferences

expand c/c++ then select Managed Build

click on new (define a variable)

Name: gtkc

Value: `pkg-config --cflags --libs gtk+-2.0`

(note backwards single quotes are important)

click OK

Repeat if you want to set up one for c++ as well using the c++ variables.

click apply

click Ok

Now you have one or two compiler variables you can apply to any c or c++ project as shown below.

select your project (in this case a c project) then

project->properties

select c/c++ Build

under GCC C Compiler-> Miscellaneous

in Other Flags add ${gtkc} at the end

select GCC C Linker->Miscellaneous

in Linker Flags add ${gtkc}

click apply

click OK.