7

where i can download the cs50.h file? I don't want the cs50 appliance.

14

If you aren't going to use the appliance, you'll need both the cs50.c and cs50.h files.

Here is cs50.c

Here is cs50.h

For specific OS-based instructions on how to use the CS50 Library in your own programs, please read the appropriate section of the CS50 Library Manual on Harvard's site. (Thanks Raphael for the comment.)

You may run into problems not using the Appliance so I would recommend that you use it unless you have some really good reasons not to. It's set up so that you don't have to worry about the environment.

5
  • thanks a ton!!!! Jul 27 '14 at 21:09
  • I downloaded those two files, but where should I save them and how should I call them in my program ? Jan 12 '15 at 21:37
  • I have this question too
    – user4741
    Jan 19 '15 at 5:31
  • Actually, I found the Answer, Ankit. All the information you need to install these files is in this website: manual.cs50.net/library/#installation
    – user4741
    Jan 19 '15 at 5:37
  • Link to CS50 Library Manual is not working anymore, it seems that is gone from the Github page. How about https://reference.cs50.net as alternative? Mar 13 '17 at 10:17
2

Head over to https://github.com/cs50/libcs50.

There you will find both files plus instructions for how to install the library so that you can compile your code with cs50.h included.

If you're using Ubuntu, it's easy, just execute the following commands in a terminal:

$ curl -s https://packagecloud.io/install/repositories/cs50/repo/script.deb.sh | sudo bash
$ sudo apt-get install libcs50

If you don't have curl, install it with

sudo apt install curl

This installs the library so now all you have to do when compiling your code is is the option -lcs50 with clang. For example,

 clang vigenere.c -lcs50

And voila, clang should compile your code along with the included cs50.h.

If you're using a different OS, check the GitHub page; it gives walkthroughs for other ones.

2
  • 1
    how about windows user's with bash installed ??
    – Jux Salley
    Sep 2 '19 at 22:09
  • @JuxSalley Gunay Anach provides a great explanation of how to do this here: Include an external library in C. If you are still stuck, let me know, and I'll try to walk you through it. Sep 3 '20 at 18:08

You must log in to answer this question.

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