我之前在聲明我的數組記錄時遇到了一些問題。現在我認爲我的Makefile或其他東西有問題。未定義的引用也許makefile是錯誤的?
Here is my Makefile:
EEXEC = proj1
CC = gcc
CFLAGS = -c -Wall
$(EXEC) : main.o set.o
$(CC) -o $(EXEC) main.o set.o
main.o : main.h main.c
$(CC) $(CFLAGS) main.c
set.o : set.h set.c
$(CC) $(CFLAGS) set.c
還有更多的功能,我在我的set.c文件,但這些都是我目前測試功能:
DisjointSet *CreateSet(int numElements);
DisjointSet *MakeSet(DisjointSet *S,int ele, int r);
void Print(DisjointSet *S);
而且我在終端接收的錯誤是:
main.o: In function `main':
main.c:(.text+0x19): undefined reference to `CreateSet'
main.c:(.text+0x43): undefined reference to `MakeSet'
main.c:(.text+0x5f): undefined reference to `Print'
突出顯示並按0101按鈕進行代碼格式化:) – 2010-11-09 05:17:41
修復了大部分問題。仍然在使用格式。 – Jeremy 2010-11-09 05:19:18