libcs50
v11.0.3
make
:建立動態庫
make deb
:建構源 deb
make install
:預設將庫安裝在/usr/local
下(設定DESTDIR
進行更改)
$ 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
預設情況下,我們安裝到/usr/local
。如果您想變更安裝位置,請根據需要執行sudo DESTDIR=/path/to/install make install
。
/usr/bin/ld: cannot find -lcs50
:將export LIBRARY_PATH=/usr/local/lib
加入.bashrc
中。fatal error: 'cs50.h' file not found
:將export C_INCLUDE_PATH=/usr/local/include
加入.bashrc
中。error while loading shared libraries: libcs50.so.8: cannot open shared object file: No such file or directory
:將export LD_LIBRARY_PATH=/usr/local/lib
新增至您的.bashrc
。關閉並重新開啟所有終端機視窗。
與-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: ");
安裝後請參考man get_*
,或 CS50 參考!