Help me to solve this error message!



Hi All,

I am trying to run a program which is used for reading data from seial port. But it is giving error message. I don't know how to solve that error message. Please give me ideas to solve this. I am using gtkmm-2.4 and os is Linux - ubuntu.

Here I have attached my program and the error message:
#include <gtkmm.h>
#include "gtkmmconfig.h"
#include <fcntl.h>
#include <iostream>
#include < unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
class serialport
{
        public:
        int read_fd;
        Glib::RefPtr<Glib::IOChannel> iochannel;
        Glib::ustring buf;
      
        bool MyCallback(Glib::IOCondition io_condition);

    serialport()
        {
                
                read_fd = open("/dev/ttyS0", O_RDONLY);
                // connect the signal handler
                Glib::signal_io().connect(sigc::ptr_fun(MyCallback), read_fd, Glib::IO_IN);
 
                // Creates a iochannel from the file descriptor
                iochannel = Glib::IOChannel::create_from_fd(read_fd);
                
        }
};
 
bool serialport::MyCallback(Glib::IOCondition io_condition)
{
   iochannel->read_line(buf);
 
   std::cout << buf;
   if (buf == "Q\n")
           Gtk::Main::quit ();

  return true;
}

int main(int argc, char *argv[])
{
 
   serialport win;
   return 0;
}

For compilation I am using this command :
g++  IO.cc -o IO  `pkg-config gtkmm-2.4 --cflags --libs` `pkg-config --libs gthread-2.0`

Error:
 
IO.cc: In constructor 'serialport::serialport()':
IO.cc:29: error: no matching function for call to 'ptr_fun(<unresolved overloaded function type>)'

-------------------------------------------------------------------------------------------------------------------------------------------
Thank you!


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