When I try to compile helper.c for the week 4 lab smiley get this error message

/usr/bin/ld: /lib/x86_64-linux-gnu/Scrt1.o: in function _start': (.text+0x1b): undefined reference to main' clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [: helpers] Error 1

Even if I delete all the code, it still won't compile.

1 Answer 1


It would seem that you're trying to compile the wrong program. If you're trying to compile a helper.c program, it will fail because there's no main() code in the helper.c file. (The pattern of cs50 assignments is that a helper.c file is part of a larger program spread across multiple files. The main program file is the one that must be compiled.)

In this case, I'm presuming that the main program name is smiley. Try make smiley and see if that cures your problem.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

You must log in to answer this question.

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