2012-04-09 3 views
1

Makefile에서 LDFLAGS와 연결할 때 라이브러리의 이름을 어떻게 알 수 있습니까? 예를 들어Makefile에서 라이브러리의 적절한 LDFLAG를 찾는 방법은 무엇입니까?

:

libxml2.dylib 실제로 그 플래그가 지정된 -lz

와 연결되어 ZLIB를 이름을 붙일 수있다 -lxml2

libz.dylib와 연결되어? 사람들이 어떻게 그들을 찾습니까?

+2

는 선도적 인'lib' 및 후행'.dylib', 그리고 앞에 추가 선도적 인'-l'를 제거합니다. 그것에 대해 너무 혼란 스럽거나 일관성이없는 것은 무엇입니까? –

답변

2

관습 적으로 라이브러리 파일 이름에서 앞의 'lib'를 제거합니다. 라는 라이브러리 파일은 'libmyspecial_library.so', 해당 플래그는 다음과 같습니다

-lmyspecial_library 

이 실제로 GCC 컴파일러 대회입니다. 더 많은 정보를 위해 gcc man page를 참조하십시오

-llibrary 
     Use the library named library when linking. 

     The linker searches a standard list of directories 
     for the library, which is actually a file named 
     `liblibrary.a'. The linker then uses this file as 
     if it had been specified precisely by name.... 
관련 문제