I have 2 files: a.c
and b.c
In a.c
I am sending a signal to a function located in b.c
signal(SIGUSR1,doSomething);
On top of the a.c file, I have:
extern void doSomething (int sig);
When I compile, however, I get an error:
/tmp/ccCw9Yun.o: In function main':
a.c:(.text+0xba): undefined reference to
doSomething'
collect2: ld returned 1 exit status
The following headers are included:
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
How do I fix this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…