6

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

2 Answers 2

15

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!!!! Commented Jul 27, 2014 at 21:09
  • I downloaded those two files, but where should I save them and how should I call them in my program ? Commented Jan 12, 2015 at 21:37
  • I have this question too
    – user4741
    Commented Jan 19, 2015 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
    Commented Jan 19, 2015 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?
    – user15344
    Commented Mar 13, 2017 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.

3
  • 1
    how about windows user's with bash installed ?? Commented Sep 2, 2019 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. Commented Sep 3, 2020 at 18:08
  • Hey so I've just moved the cs50.h and cs50.c files over to where stdio lives and while lint is happy. The cs50 methods aren't being recognised. I have the Ubuntu dist, but will I be able to save to windows os or will it only be available on the unix os side on my pc?
    – Lauro235
    Commented Dec 11, 2022 at 19:15

You must log in to answer this question.

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