fork and gtk



Currently I am hjaving a problem with using fork() and the following should 
explain better what example or what I am trying to do.  If the fork() 
function is used in the function of main(), then 'fork()' is recognized but 
not if used in another function.



With regard to the fork() command.  The following is some source code
but it may just be some compilation problem and not a gtk problem.

#include <sys/types.h>
#include <sys/wait.h>

void quit(GtkButton *was_clicked, gpointer user_data)
{
  pid_t pid;
  pid = fork();
  g_print("bye\n");
  gtk_main_quit();
}

if fork is used in this function, I get a warning that 'implicit 
declaration of fork() function' or something similar.  However, if fork() 
is used in
the main function ie
int main(int argc, char *argv[])
{
  pid_t pid;
  pid = fork();



}

seems to compile and work fine.  Is this a gtk limitation that it needs to 
work in main.  And I am not permanently putting fork() in my quit function, 
although I did try it and got the same warning so it seems like all 
functions are like this.






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