[sigc] compile error



While reading chapter 2. Connecting your code to signals from the
libsigc++ documentation:
http://libsigc.sourceforge.net/libsigc1_2/manual/html/ch02.html#id2773405

I tried to compile the simple example by using the instructions at the
bottom of the page:

g++ example1.cc -o eg1 `pkg-config --cflags --libs sigc++-1.2`


I get the following error message:

/tmp/ccXfsmCT.o(.text+0x47): In function `main':
: undefined reference to `AlienDetector::AlienDetector[in-charge]()'
/tmp/ccXfsmCT.o(.text+0xbb): In function `main':
: undefined reference to `AlienDetector::run()'
collect2: ld returned 1 exit status


for reference purposes here is my complete code:
 
#include <iostream>
#include <sigc++/sigc++.h>

#ifdef SIGC_CXX_NAMESPACES
using namespace std;
using namespace SigC;
#endif


class AlienDetector
{
public:
    AlienDetector();

    void run();

    SigC::Signal0<void> detected;
};

void warn_people()
{
    cout << "There are aliens in the carpark!" << endl;
}

int main()
{
   AlienDetector mydetector;
   mydetector.detected.connect( SigC::slot(warn_people) );

   mydetector.run();

    return 0;
}

Please can someone tell me what I need to do to properly compile the
code.

kind regards
Mattheos




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]