我有2個文件:a.c
和b.c
C中的「未定義的varName引用」是什麼意思?
在a.c
我將信號發送到位於b.c
signal(SIGUSR1,doSomething);
的交流文件頂部的功能,我有:
extern void doSomething (int sig);
然而,當我編譯時,我得到一個錯誤:
個/tmp/ccCw9Yun.o: In function
main':
doSomething'
a.c:(.text+0xba): undefined reference to
collect2: ld returned 1 exit status
以下標頭包括:
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
我該如何解決這個問題?
請顯示您的標題('.h')文件。 – 2011-05-05 02:41:39
這是一個鏈接器錯誤 – 2011-05-05 02:42:28
在'b.c'中實際定義了'doSomething'嗎? – Borealid 2011-05-05 02:42:52