make: builds dynamic library
make deb: builds source deb
make hack: combines library into cs50.h
make install: installs the library under /usr/local by default (set DESTDIR to change that)
sudo apt-get install software-properties-common whiptail
sudo apt-add-repository ppa:cs50/ppa
sudo apt-get update
sudo apt-get install libcs50
- Download the latest release per https://github.com/cs50/libcs50/releases
- Extract
libcs50-*.* cd libcs50-*gem install asciidoctor, as needed
If on Mac:
make install
If on Linux:
makesudo make install
By default, we install to /usr/local. If you'd like to change the installation location, run
sudo DESTDIR=/path/to/install make install as desired.
- If, when compiling a program, you see
/usr/bin/ld: cannot find -lcs50: Addexport LIBRARY_PATH=/usr/local/libto your.bashrc. - If, when compiling a program, you see
fatal error: 'cs50.h' file not found: Addexport C_INCLUDE_PATH=/usr/local/includeto your.bashrc. - If, when executing a program, you see
error while loading shared libraries: libcs50.so.8: cannot open shared object file: No such file or directory: Addexport LD_LIBRARY_PATH=/usr/local/libto your.bashrc.
Close and reopen any terminal windows.
Link with -lcs50.
#include <cs50.h>
...
char c = get_char("Prompt: ");
double d = get_double("Prompt: ");
float f = get_float("Prompt: ");
int i = get_int("Prompt: ");
long l = get_long("Prompt: ");
string s = get_string("Prompt: ");
// deprecated as of fall 2017
long long ll = get_long_long("Prompt: ");
See man get_* and man eprintf after installation, or CS50 Reference!
- Add tests.