summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile.am6
-rw-r--r--examples/hello_world.cc28
2 files changed, 34 insertions, 0 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644
index 0000000..e1ac82f
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,6 @@
+LDADD = $(top_builddir)/sigc++/libsigc-2.0.la
+AM_CPPFLAGS = -I$(top_srcdir)
+
+noinst_PROGRAMS = hello_world
+
+hello_world_SOURCES = hello_world.cc
diff --git a/examples/hello_world.cc b/examples/hello_world.cc
new file mode 100644
index 0000000..3febe35
--- /dev/null
+++ b/examples/hello_world.cc
@@ -0,0 +1,28 @@
+/* Copyright 2003, The libsigc++ Development Team
+ *
+ * Assigned to the public domain. Use as you wish without
+ * restriction.
+ */
+
+#include <iostream>
+#include <string>
+
+#include <sigc++/signal.h>
+#include <sigc++/functors/ptr_fun.h>
+
+using namespace std;
+using namespace sigc;
+
+void print(const string &str)
+{
+ cout << str;
+}
+
+main()
+{
+ signal<void, const string&> printer;
+
+ printer.connect(ptr_fun(&print));
+
+ printer("hello world\n");
+}