libcs50
v11.0.3
make : Erstellt eine dynamische Bibliothek
make deb : Erstellt Quell-Deb
make install : Installiert die Bibliothek standardmäßig unter /usr/local (setzen Sie DESTDIR , um das zu ändern)
$ curl -s https://packagecloud.io/install/repositories/cs50/repo/script.deb.sh | sudo bash
$ sudo apt-get install libcs50
$ curl -s https://packagecloud.io/install/repositories/cs50/repo/script.rpm.sh | sudo bash
$ yum install libcs50
libcs50-*.*cd libcs50-*sudo make install Standardmäßig installieren wir nach /usr/local . Wenn Sie den Installationsort ändern möchten, führen Sie wie gewünscht sudo DESTDIR=/path/to/install make install aus.
/usr/bin/ld: cannot find -lcs50 : Fügen Sie export LIBRARY_PATH=/usr/local/lib zu Ihrer .bashrc hinzu.fatal error: 'cs50.h' file not found : Fügen Sie export C_INCLUDE_PATH=/usr/local/include zu Ihrer .bashrc hinzu.error while loading shared libraries: libcs50.so.8: cannot open shared object file: No such file or directory : Fügen Sie export LD_LIBRARY_PATH=/usr/local/lib zu Ihrer .bashrc hinzu.Schließen Sie alle Terminalfenster und öffnen Sie sie erneut.
Link mit -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: ");
Siehe man get_* nach der Installation oder CS50-Referenz!