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 표시되는 경우: .bashrc 에 export LIBRARY_PATH=/usr/local/lib 추가하세요.fatal error: 'cs50.h' file not found . .bashrc 에 export C_INCLUDE_PATH=/usr/local/include 추가하세요.error while loading shared libraries: libcs50.so.8: cannot open shared object file: No such file or directory . .bashrc 에 export LD_LIBRARY_PATH=/usr/local/lib 추가하세요.모든 터미널 창을 닫았다가 다시 엽니다.
-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 참조를 참조하세요!