Problems compiling sigc++ example
Hi,
i'm trying to get sigc++ working with the example files from the tutorial of libsigc++;
http://libsigc.sourceforge.net/libsi...html#id2446517
AlienDetector.h
Code:
#include <iostream>
#include "sigc++/object.h"
#include <string>
#include "sigc++/signal.h"
class AlienDetector
{
public:
AlienDetector();
void run();
sigc::signal<void> signal_detected;
};
AlienDetector.cc
Code:
#include "AlienDetector.h"
void warn_people()
{
cout << "There are aliens in the carpark!" << endl;
}
int main()
{
AlienDetector mydetector;
mydetector.signal_detected.connect( sigc::ptr_fun(warn_people) );
mydetector.run();
return 0;
}
Compileline:
Code:
g++ -Wall AlienDetector.cc -o AlienDetector.o -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -lsigc-2.0
Error:
Code:
/tmp/ccBPmiQJ.o: In function `main':AlienDetector.cc:(.text+0x50): undefined reference to `AlienDetector::AlienDetector()'
:AlienDetector.cc:(.text+0xcb): undefined reference to `AlienDetector::run()'
collect2: ld returned 1 exit status
In the tutorial the compileline is using pkconfig inside, which i can't use in the project I want to use sigc with. So i wrote a compileline myself, which should work in my opinion.
Thanks for the help
Hork83