|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
one question about glibHello, List!
Recently, I am writing a little program with gtk+ on win32 platform. In this program I use g_spawn_async_with_pipes(NULL,cmd_line,NULL,G_SPAWN_SEARCH_PATH,NULL,NULL,NULL,NULL,&std_out,NULL,NULL); to call gcc and as a result the command line has executed successfully .However when I use g_io_channel_reda_chars(channel,out,-1,&bytes_read,NULL) to get the standard out stored in out, it turns out to be wrong.Here is my code : gchar *cmd_line[] = {"gcc","-o","temp.exe","temp.c","-mms-bitfields", "-lgtk-win32-2.0", "-lgdk-win32-2.0", "-latk-1.0", "-lgdk_pixbuf-2.0", "-lpangowin32-1.0", "-lgdi32" ,"-lpango-1.0" ,"-lgobject-2.0" ,"-lgmodule-2.0", "-lglib-2.0" ,"-lintl"}; gchar out[1024]; GIOChannel *channel; gint std_out = 0; gint bytes_read; g_spawn_async_with_pipes(NULL,cmd_line,NULL,G_SPAWN_SEARCH_PATH,NULL,NULL,NULL,NULL,&std_out,NULL,NULL); channel = g_io_channel_unix_new(std_out); g_io_channel_read_chars(channel,out,-1,&bytes_read,NULL); If I want to get the standard out ,what should I do? Any info is appreciated ! :) _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@... http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list |
|
|
Re: one question about glib> However when I use g_io_channel_reda_chars(channel,out,-1,&bytes_read,NULL) to get the standard out stored in out, it turns out to be wrong.
In what way is it wrong? A successful run of gcc to compile and link a program produces no output. > gchar *cmd_line[] = {"gcc","-o","temp.exe","temp.c","-mms-bitfields", "-lgtk-win32-2.0", "-lgdk-win32-2.0", "-latk-1.0", "-lgdk_pixbuf-2.0", "-lpangowin32-1.0", "-lgdi32" ,"-lpango-1.0" ,"-lgobject-2.0" ,"-lgmodule-2.0", "-lglib-2.0" ,"-lintl"}; You forget the terminating NULL element in the argv. Also, are you sure that gcc will find the GTK+ headers and libraries? You don't pass any -I and -L flags. If you have copied the GTK+ stack headers and libraries into your mingw installation (so that gcc and ld will find them without any -I and -L options), I would say that is a bad idea. Better to keep stuff from different distributions separate and not copy headers and libraries around. And in general, instead of manually constructing (or hardcoding) the correct -I, -L and -l options, just use pkg-config. --tml _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@... http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |