gcc에서 라이브러리 파일을 사용하여 실행파일을 만들때는 -l과 -L 옵션을 사용하여 만드는 방법이 있다. -l 라이브러리의 이름을 적어주는 옵션 -L 라이브러리가 포함된 디렉토리를 적어주는 옵션 예를 들어 라이브러리의 이름이 libtest.a이고 위치가 libs 폴더에 있다면, (1)$ g++ -o out main.cpp -ltest.a -Llibs (2)$ g++ -o out main.cpp -ltest -L. 이런 형식으로 사용을 하면 된다. (1) 리눅스에서 라이브러리는 반드시 lib 로 시작이 되며, 옵션에 라이브러리 이름을 적을 때, lib는 생략하고 이름을 적으면 된다. 즉, libtest.a는 test.a라고 적으면 된다. (2) 현재 폴더에 있는 라이브러리를 쓴다는 말이다.
1. 설치 코드 다운로드 주소 : https://github.com/gperftools/gperftools/releases gperftools/gperftools Main gperftools repository. Contribute to gperftools/gperftools development by creating an account on GitHub. github.com 다운로드 후 순서대로 명령어 수행 $ tar -zxvf gperftools-2.7.tar.gz $ cd gperftools-2.7 $ sudo ./configure $ sudo make $ sudo make install 빌드가 끝나면, 기본 위치인 /usr/local/lib 폴더에 라이브러리 파일이 생성된다. 이 문서에서 링킹 할..