Need help in resolving a compiler error: error: invalid conversion from ‘int’ to ‘GIOCondition’
- by michael
I have a simple cpp file which uses GIO. I have stripped out everything to show my compile error:
Here is the error I get:
My.cpp:16: error: invalid conversion from ‘int’ to ‘GIOCondition’
make[2]: *** [My.o] Error 1
Here is the complete file:
#include <glib.h>
static gboolean
read_socket (GIOChannel *gio, GIOCondition condition, gpointer data)
{
return false;
}
void createGIOChannel() {
GIOChannel* gioChannel = g_io_channel_unix_new(0);
// the following is the line causing the error:
g_io_add_watch(gioChannel, G_IO_IN|G_IO_HUP, read_socket, NULL);
}
I have seen other example using gio, and I am doing the same thing in term of calling G_IO_IN|G_IO_HUP.
And the documentation http://www.gtk.org/api/2.6/glib/glib-IO-Channels.html, said I only need to include , which I did.
Can you please tell me how to resolve my error?
One thing I can think of is I am doing this in a cpp file. But g_io_add_watch is a c function?
Thank you for any help. I have spent hours on this but did not get anywhere.