"Fossies" - the Fresh Open Source Software Archive

Member "libsigc++-3.0.0/docs/docs/reference/html/index.html" (5 Sep 2019, 5692 Bytes) of package /linux/misc/libsigc++-3.0.0.tar.xz:

Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the project site itself.

libsigc++  3.0.0
libsigc++ Reference Manual


libsigc++ provides a typesafe (at compile time) callback system for standard C++. It allows you to define signals and to connect those signals to any callback function, either a global or a member function, regardless of whether it is static or virtual. It also contains adaptor classes for connection of dissimilar callbacks.

For instance, see the Signals, Functors, Slots and Adaptors.

See also the libsigc++ tutorial, the libsigc++ website, and the Signals appendix of the Programming with gtkmm book.


Basic Usage

Include the libsigc++ header:

#include <sigc++/sigc++.h>

(You may include individual headers, such as sigc++/bind.h instead.)

If your source file is program.cc, you can compile it with:

g++ program.cc -o program `pkg-config --cflags --libs sigc++-3.0`

Using Autotools

Alternatively, if using autoconf, use the following in configure.ac:

PKG_CHECK_MODULES([DEPS], [sigc++-3.0])

Then use the generated DEPS_CFLAGS and DEPS_LIBS variables in the project Makefile.am files. For example:

yourprogram_CPPFLAGS = $(DEPS_CFLAGS)
yourprogram_LDADD = $(DEPS_LIBS)

Your PKG_CHECK_MODULES() call should also mention any other libraries that you need to use via pkg-config.

Using CMake

If using CMake, use the following in CMakeList.txt:

pkg_check_modules(DEPS REQUIRED sigc++-3.0)
target_link_libraries(yourprogram ${DEPS_LIBRARIES})

Your pkg_check_modules() call should also mention any other libraries that you need to use via pkg-config.