So I'm doing my final project and am trying to incorporate some of the functions from dictionary.c
into my program. I have included #include "dictionary.h"
at the top of my file as was done in speller.c
before, as well as included dictionary.h
dictionary.c
and dictionary.o
files to the same folder but I am getting the following error:
jharvard@appliance (~/Dropbox/project): make encrypt
clang -ggdb3 -O0 -Qunused-arguments -std=c99 -Wall -Werror encrypt.c -lcs50 -lm -o encrypt
/tmp/encrypt-5da335.o: In function `main':
/home/jharvard/Dropbox/project/encrypt.c:103: undefined reference to `load'
/home/jharvard/Dropbox/project/encrypt.c:151: undefined reference to `check'
/home/jharvard/Dropbox/project/encrypt.c:166: undefined reference to `unload'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [encrypt] Error 1
Any ideas? Thanks!
Update: So after changing it to include "dictionary.c"
I get errors like this:
/home/jharvard/Dropbox/project/dictionary.c:34: multiple definition of `root'
encrypt.o:/home/jharvard/Dropbox/project/./dictionary.c:34: first defined here
dictionary.o: In function `size':
Here is my makefile
:
# # compiler to use
# CC = clang
# # flags to pass compiler
# CFLAGS = -ggdb3 -O0 -Qunused-arguments -std=c99 -Wall -Werror -lm
# # name for executable
# EXE = encrypt
# # space-separated list of header files
# HDRS = dictionary.h
# # space-separated list of libraries, if any,
# # each of which should be prefixed with -l
# LIBS = -lcs50
# # space-separated list of source files
# SRCS = encrypt.c dictionary.c
# # automatically generated list of object files
# OBJS = $(SRCS:.c=.o)
# # default target
# $(EXE): $(OBJS) $(HDRS) Makefile
# $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
# # dependencies
# $(OBJS): $(HDRS) Makefile
# # housekeeping
# clean:
# rm -f core $(EXE) *.o