I have compiled find.c, generate.c and helpers.c. When I compile make all, I get the following error message:

jharvard@appliance (~/Dropbox/pset3/find): make all
clang -ggdb3 -O0 -std=c99 -Wall -Werror -o find find.c helpers.c -lcs50 -lm
/tmp/helpers-AiXL3Q.o:(.rodata+0x0): multiple definition of `MAX'
/tmp/find-yhxwC5.o:(.rodata+0x0): first defined here
/tmp/helpers-AiXL3Q.o: In function `main':
/home/jharvard/Dropbox/pset3/find/./find.c:25: multiple definition of `main'
/tmp/find-yhxwC5.o:/home/jharvard/Dropbox/pset3/find/find.c:25: first defined here
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Both generate.c and helper.c compile fine when I "make " them individually, however when I compile find.c by itself, I get the same error message as above. Since find.c is a read only file, what can I do?

1 Answer 1


You have more than one variable with the name MAX. Make sure you don't have another global variable named MAX in helpers.h. And of course you should either remove the other variable(s) named MAX or change their names.

Also, you seem to be having multiple definitions of the main() function. You shouldn't be defining main() in helpers.c (if you're already doing so).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .