fam
[Top] [All Lists]

compile erro

To: <fam@xxxxxxxxxxx>
Subject: compile erro
From: 汪滔 <wangtao@xxxxxxxxxxxxxxxxx>
Date: Wed, 4 Jun 2008 15:07:14 +0800
Sender: fam-bounce@xxxxxxxxxxx
Thread-index: AcjGEZ3qiIxTrwZDRJOuXTfUSyLOSw==

My code:

#include <fam.h>

#include <sys/time.h>

#include <sys/stat.h>

#include <sys/socket.h>

#include <sys/select.h>

#include <sys/un.h>

#include <stdio.h>

#include <string.h>

#include <unistd.h>

#include <stdlib.h>

#include <signal.h>

#include <errno.h>

#include <stdarg.h>

#include <fcntl.h>

int main(int argc,char *argv[])

{

        int i,nmon,rc,fam_fd;

        FAMConnection fc;

        FAMRequest *frp;

        struct stat status;

        fd_set readfds;

        char cmd[256];

 

        frp=malloc(argc*(sizeof(*frp)));

        if(!frp)

        {

                perror("malloc");

                exit(1);

        }

 

        if((FAMOpen(&fc)) < 0)

        {

        perror("fam");

        exit(1);

        }

 

        rc=FAMMonitorDirectory(&fc,argv[0],frp,NULL);

        if(rc<0)

        {

        perror("FAMMonitor failed");

        }

        memset(cmd,0,256);

        sprintf(cmd,"rsync -rlopgztC --delete  -e 'rsh' %s %s",argv[0],argv[1]);

        while(1)

        {

                if(FAMPending(&fc)==1)

                {

                        system("date");

                        system(cmd);

                        system("date");

                }

        }

 

}

 

 

Compile : gcc ?o mirror mirror.c

 

Erro:

mirror.c:(.text+0x51): undefined reference to `FAMOpen'

mirror.c:(.text+0x85): undefined reference to `FAMMonitorDirectory'

mirror.c:(.text+0xea): undefined reference to `FAMPending'

collect2: ld returned 1 exit status

 

<Prev in Thread] Current Thread [Next in Thread>
  • compile erro, 汪滔 <=