This is the first time I install a library. I followed the instructions here. It’s from an online course on programming.
I’m not very Unix savvy. When I tried to compile one of the sample c files, one that #includes the cs50.h file, I get:
cc1: error: /usr/local/include: not a directory
Also, if I write cd /usr/local/include or cd /usr/local/lib, it tells me it’s not a directory again, even though when I ls /usr/local they both show up.
Any ideas?
Given that the instructions in the header are:
% 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/libNote 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 usesudoas a prefix to the commands:We can deduce (with fairly high confidence) that you did not already have directories
/usr/local/includeand/usr/local/lib, and that you now have two files (not directories) called:/usr/local/includethat contains the header cs50.h/usr/local/libthat contains the static libraryYou should validate this observation with
ls -l /usr/localand perhapsfile /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.)