Given that the instructions in the header are:
- To compile as a static library on your own system:
% gcc -c -ggdb -std=c99 cs50.c -o cs50.o
% ar rcs libcs50.a cs50.o
% rm -f cs50.o
% cp cs50.h /usr/local/include
% cp libcs50.a /usr/local/lib
Note the use of '%' as a prompt. It indicates that the operations should be done as root.
Unless your system is misconfigured, you will need to use root privileges to copy the files into the directories under /usr/local
. For example, you might use sudo
as a prefix to the commands:
sudo cp cs50.h /usr/local/include
sudo cp libcs50.a /usr/local/lib
We can deduce (with fairly high confidence) that you did not already have directories /usr/local/include
and /usr/local/lib
, and that you now have two files (not directories) called:
/usr/local/include
that contains the header cs50.h
/usr/local/lib
that contains the static library
You should validate this observation with ls -l /usr/local
and perhaps file /usr/local/*
. Then you should remove the files, create the directories, and copy the files into the newly created directories.
The only thing this explanation does not account for is the missing leading slash in the error message (which originally said 'cc1: error: usr/local/include: not a directory
'). At the moment, I put that down to a transcription error in asking this question. (And a comment and edit confirms that diagnosis.)