LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   libsigc++ on Ubuntu - won't compile (https://www.linuxquestions.org/questions/programming-9/libsigc-on-ubuntu-wont-compile-777207/)

skiman1979 12-21-2009 07:18 AM

libsigc++ on Ubuntu - won't compile
 
Hi all,

Does anyone have any experience with libsigc++ (1.2 or 2.0) on Linux?

I'm currently working on a C++ console application (using Eclipse) that has a few classes and I wanted to enable certain classes to raise events back to event handlers in main.cpp. I came across libsigc++-2.0 but am having problems actually using it.

It installs just fine on my Ubuntu 9.04 box (both the runtime and dev packages) but I'm not sure what to actually #include in my source code. I tried following the tutorial on the libsigc++ site (Chapter 2. Connecting your code to signals) but it doesn't give any information on what libsigc++ headers I need.

I think I narrowed it down to #include <sigc++-2.0/sigc++/signals.h>, but I am getting hundreds of compiler errors similar to " '_A_a1_' was not declared in this scope" referencing signal.h.

Following is some code for my class header. I haven't put anything into the implementation file yet, or main.cpp.

Code:

#include <pthread>
#include <stdlib>
#include <iostream>
#include <fstream>
using namespace std;

#include <sigc++-2.0/sigc++/signal.h>

class MyClass
{
public:
        MyClass();
        virtual ~MyClass();

        sigc::signal<void,int> MySignal1;
        sigc::signal<void,int> MySignal2;

        void WaitForSomething();  //reads certain files and triggers events
};

My intent was in WaitForSomething() to execute MySignal1.emit() (or MySignal2.emit()), which would be connected to OnMySignalX functions in main.cpp, but that part hasn't been written yet.

On a side note: For some reason, if I remove 'int' from the MySignal1 or MySignal2 declaration (e.g., sigc::signal<void> MySignal1;, the compiler tells me I have an invalid entry for argument 2. I thought signal was supposed to be a wrapper so only the first argument (the template's return type) is required.


All times are GMT -5. The time now is 09:10 PM.