GNet Network Library Reference Manual
<<< Previous Page | Home |  | Next Page >>>

# GNet for developers

# Compiling programs with GNet

If you are a developer and you want to use GNet in your program, you can use the gnet-config script to figure out which flags need to set when compiling. For example, type `gcc main.c `gnet-config --cflags --libs`` to compile the program main.c with GNet and link it to GNet.

If you use autoconf and automake, you can use the `gnet.m4` macros to set the appropriate variables. Just add this to your configure.in:

    dnl Need GNet
    AM_PATH_GNET(<version number>,
      [LIBS="$LIBS $GNET_LIBS" CFLAGS="$CFLAGS $GNET_CFLAGS"],
      AC_MSG_ERROR(Cannot find GNet: Is gnet-config in path?))

Where <version number> is the version of GNet you're using (e.g. 1.0.4). You can get the version number by doing `gnet-config --version`.

<<< Previous Page | Home |  | Next Page >>>
GNet Overview | Other tips and tricks