The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 06-29-2009
konvalo konvalo is offline
Registered User
  
 

Join Date: Jan 2002
Posts: 20
Question warning: int format,pid_t arg (arg 2)

I try following code under Solaris10,like follows:


Code:
int glob = 6;
int main(void)
{
  int var;
  pid_t pid;
  var = 88;
  printf("before vfork\n");
  if ((pid = vfork()) < 0) {
    err_sys("vfork error");
  } else if (pid == 0) { 
      glob++;
     var++;
     _exit(0);
  }
  printf("pid = %d, glob = %d, var = %d\n", getpid(), glob, var);
  exit(0);
}

When I compile it,it raise following warning
$gcc -Wall abc.c error.obj
abc.c: In function 'main':
abc.c:16: warning: int format,pid_t arg (arg 2)
ld: warning: symbol 'glob' has differing types:
(file /var/tmp//ccIMPxLe.o type=OBJT; file/usr/lib/libc.so type=FUNC);
/var/tmp//ccIMPxLe.o definition take
ld: warning: symbol 'glob' has differing types:
(file /var/tmp//ccIMPxLe.o type=OBJT; file/usr/lib/libc.so type=FUNC);

Why raise above warning? How to correct it?

Thanks in advance