2011-09-20 7 views
3

xcode 작업 공간에 2 개의 프로젝트가 있습니다. 하나는 정적 라이브러리이고 다른 하나는 정적 라이브러리를 사용합니다.iphone - ".../libtool : -lxml2 파일을 찾을 수 없습니다"

정적 라이브러리에서 기본 프로젝트에서 사용하는 GDataXMLNode.h 및 GDataXMLNode.m 파일을 추가했습니다. GDataXMLNode.h는 공용 파일이므로 기본 프로젝트에 표시됩니다. 또한 두 프로젝트의 대상을 libxml2.dylib과 연결했습니다. 또한 헤더 검색 경로와 사용자 헤더 검색 경로에/usr/include/libxml2 위치를 포함시킵니다.

이 있지만, 나는 애플 마하-O 라이브러리 오류를 얻을 :

/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: can't locate file for: -lxml2 
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: file: -lxml2 is not an object file (not allowed in a library) 
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: file: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libxml2.dylib is a dynamic library, not added to the static library 
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: file: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libxml2.dylib is a dynamic library, not added to the static library 
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: file: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libz.dylib is a dynamic library, not added to the static library 
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool: file: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libz.dylib is a dynamic library, not added to the static library 
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool failed with exit code 1 

나는이 문제를 해결할 수있는 방법을 알고 있습니까?

+0

나는 어제부터 노력하고 있지만 지금은 빠르다. 빌드 설정에서 제거하여 문제를 해결할 수 있습니다. OTHER_LDFLAGS = "-lxml2"; 여러분 모두를 기원합니다! – Bogdan

답변

9

나는 최근에 정확히 같은 오류가있었습니다. 찾은 것처럼 Build Settings의 "Other Linker Flags"에서 "-lxml2"를 제거하면 오류를 해결하는 데 도움이됩니다. 이것은 정적 라이브러리를 빌드 할 때 사실입니다. 은 정적 라이브러리를 실제로 포함하는 대상에 해당 링커 플래그 ("-lxml2")를 포함해야합니다. 예를 들어 정적 라이브러리에 대한 단위 테스트 (예 : MyStaticLibraryProjectTests)를 만든 경우 링커 플래그를 MyStaticLibraryProjectTests 타겟에 추가하고 실제 MyStaticLibraryProject 타겟에는 추가하지 않아야합니다. 종종 빌드 설정 탭을 살펴볼 때 특정 대상을 선택하는 것을 잊어 버리는 경우가 많습니다. 나는 보통 큰 파란색 프로젝트 아이콘을 클릭하면 빌드 설정이 전체 프로젝트에만 적용되지만 그 설정을 수정할 때 올바른 대상을 선택하는 것이 매우 중요하다고 가정합니다.

대부분의 프로젝트 초기에는 일반적으로 하나의 대상 만 있지만 더 고급화되면 각 프로젝트마다 여러 대상을 가질 수 있습니다. 희망이 도움이됩니다.

관련 문제