Previous Next Table of Contents

3. Compiling A New Plug-In

The easiest way to compile a new plug-in is to use a make file. Take a look at the original Makefile coming with The GIMP and check it out.

If you want to compile a new plug-in called newfilter.c just add it to the following list in the make file:

FILTERSRC = blur.c relief.c to-gray.c       \
            to-color.c to-indexed.c         \
            and-so-on.c some-more-filters.c \
            just-add-the-new-one.c          \
            newfilter.c

That should work for many of your plug-ins. Test it in your shell and type

make newfilter

to see what happens. Everything is ok, if you get no errors. Suppose you get something like

gcc ... newfilter.c ...
/tmp/cca001461.o(.text+0x67f): undefined reference to `pow'
/tmp/cca001461.o(.text+0x6a8): undefined reference to `rint'
...
make: *** [newfilter] Error 1

then you probably have included the math-library and maybe some other libraries also that need special compiler options. In that case you have to add the following lines (depending on the used libraries) to the Makefile:

newfilter: newfilter.c $(LIBGIMP)
           -$(CC) $(CFLAGS) $(LINCLUDE) -o newfilter \
                  newfilter.c $(LIBGIMP) -lc -lm

That should fit for most plug-ins. If you really get errors after inserting these lines you should check the Makefile on the following stuff:


Previous Next Table of Contents