1

I'm approaching pset4 (Breakout) by making an exact copy of breakout.c, which I've named breakout1.c. This should let me insert my code into the copy and still have the original breakout.c to refer to when I make my inevitable typos.

But breakout1.c won't compile. I get this error message:

clang -ggdb3 -O0 -std=c99 -Wall -Werror    breakout1.c  -lcs50 -lm -o breakout1
breakout1.c:16:10: fatal error: 'gevents.h' file not found
#include "gevents.h"
         ^
1 error generated.

jharvard@appliance (~/Dropbox/pset4):

breakout.c and breakout1.c are identical for each of their 183 lines (including line 16).

Why could I be getting this error?

2

You should have the folder named spl and the file named spl.jar in the same folder as your breakout1.c in order for your program to compile and run successfully. You should also add these options to the compilation command

-Ispl/include // specify the path for the include files
-Lspl/lib // specify the path to the library binary file
-lcs // link the library binary file

Your final compilation command may look like that

clang -Ispl/include breakout1.c -Lspl/lib -lcs -lm -o breakout1

Of course you may add any additional options you want.

Another quick and dirty trick is to copy the Makefile from pset4 files, open it, change every occurrence of breakout to breakout1, save it, close it and put it in the same folder as your breakout1.c along with the spl folder and spl.jar. This way,

make breakout1

should work just fine!

3
  • Using your clang command worked. Thanks very much. Is this something I should have know how to do at this point in cs50? I did make sure that breakout1.c was in pset4 along with breakout.c, but assumed that was sufficient. Oct 24 '14 at 19:13
  • @RobertFeduniak if this answers your question, please accept the answer to mark your question as solved! Thank you!
    – kzidane
    Oct 24 '14 at 19:16
  • @RobertFeduniak: actually, the compiler, its flags and make file were discussed in one of the earlier sessions. But there were no tasks on this topic.
    – user2477
    Oct 24 '14 at 20:34

You must log in to answer this question.

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