Re: Help me to solve this error message!
- From: Murray Cumming <murrayc murrayc com>
- To: SaiKamesh Rathinasabapathy <rsaikamesh gmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: Help me to solve this error message!
- Date: Wed, 28 Mar 2007 12:03:16 +0200
On Wed, 2007-03-28 at 15:27 +0530, SaiKamesh Rathinasabapathy wrote:
> 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),
sigc::ptr_fun() is for global (or static) functions. But your
MyCallback() is a member function, of your serialport.
sigc::mem_fun() is probably what you want.
> 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!
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
--
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]