0

I get multiple errors when I try to compile speller.c from pset6. I've tried switching to -std=gnu89 and I get the same thing. What is going on?

jharvard@appliance (~/Dropbox/pset6): make
clang -ggdb3 -O0 -Qunused-arguments -std=c99 -Wall -Werror   -c -o speller.o speller.c
clang -ggdb3 -O0 -Qunused-arguments -std=c99 -Wall -Werror   -c -o dictionary.o dictionary.c
clang -ggdb3 -O0 -Qunused-arguments -std=c99 -Wall -Werror -o speller speller.o dictionary.o 
dictionary.o: In function `check':
/home/jharvard/Dropbox/pset6/dictionary.c:49: multiple definition of `check'
speller.o:/home/jharvard/Dropbox/pset6/./dictionary.c:49: first defined here
dictionary.o: In function `createNode':
/home/jharvard/Dropbox/pset6/dictionary.c:32: multiple definition of `createNode'
speller.o:/home/jharvard/Dropbox/pset6/./dictionary.c:32: first defined here
dictionary.o: In function `load':
/home/jharvard/Dropbox/pset6/dictionary.c:76: multiple definition of `load'
speller.o:/home/jharvard/Dropbox/pset6/./dictionary.c:76: first defined here
dictionary.o: In function `createNode':
/home/jharvard/Dropbox/pset6/dictionary.c:32: multiple definition of `numberOfWords'
speller.o:/home/jharvard/Dropbox/pset6/./dictionary.c:32: first defined here
dictionary.o: In function `createNode':
/home/jharvard/Dropbox/pset6/dictionary.c:32: multiple definition of `root'
speller.o:/home/jharvard/Dropbox/pset6/./dictionary.c:32: first defined here
dictionary.o: In function `size':
/home/jharvard/Dropbox/pset6/dictionary.c:127: multiple definition of `size'
speller.o:/home/jharvard/Dropbox/pset6/./dictionary.c:127: first defined here
dictionary.o: In function `unload':
/home/jharvard/Dropbox/pset6/dictionary.c:137: multiple definition of `unload'
speller.o:/home/jharvard/Dropbox/pset6/./dictionary.c:137: first defined here
clang: error: linker command failed with exit code 1 (use -v to see invocation)
6
  • Did you modify the provided Makefile?
    – curiouskiwi
    Oct 2 '14 at 1:58
  • @curiouskiwi - Only after having the problem. I changed c99 to gnu89. When that did not work I reset it to what it was. Should I be modifying it otherwise? I didn't create or include any other files for this pset. Oct 2 '14 at 17:23
  • The problem could be that I am calling libraries in "dictionary.c" that are already called in "speller.c". However, I have to call these libraries in dictionary.c or else some of my code won't work (since dictionary.c doesn't know that speller.c called them). Would this cause the problem? Is there a way to go about fixing it? Oct 2 '14 at 17:41
  • You should be able to include the libraries in your makefile as outlined in the pset instructions. It also looks like you are defining your functions in multiple places, which the compiler does not like.
    – lethaljd
    Oct 2 '14 at 19:39
  • Clang thinks that I am declaring the functions twice in a row. From what I've gathered, this is a syncing problem having that often happens when you are using code that doesn't work with your specific version clang. However, the common fix, changing to version gnu89, didn't work. Oct 3 '14 at 2:22

You must log in to answer this question.

Browse other questions tagged .