programing tip

libxml / tree.h 해당 파일 또는 디렉토리 없음

itbloger 2020. 8. 21. 07:24
반응형

libxml / tree.h 해당 파일 또는 디렉토리 없음


다음과 같은 오류가 발생합니다.

libxml / tree.h 해당 파일 또는 디렉토리 없음

이미 libxml2.dylib프로젝트에 추가 했지만 이런 유형의 문제가 발생합니다. 제발 도와주세요.


지시에 따라 여기 에서, "프로젝트 파일 설정."

프로젝트 파일 설정

프로젝트에 libxml2.dylib를 추가해야합니다 (프레임 워크 섹션에 넣지 마십시오). Mac에서는에서 찾을 수 /usr/lib/libxml2.dylib있고 iPhone에서는 /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/usr/lib/libxml2.dylib버전을 원할 것 입니다.

libxml2는 .dylib (친근한 .framework가 아님)이기 때문에 여전히해야 할 일이 하나 더 있습니다. 프로젝트 빌드 설정 (프로젝트-> 프로젝트 설정 편집-> 빌드)으로 이동하여 "검색 경로"를 찾으십시오. "Header Search Paths"에서 다음 경로를 추가합니다.

$(SDKROOT)/usr/include/libxml2

또한 OP의 답변을 참조하십시오 .


Xcode 4.3 / 5 / 6에 libxml2 추가

libxml2를 추가하는 것은 엉덩이에 크고 뚱뚱하고 까다로운 고통입니다. 그렇게하려는 경우 프로젝트를 너무 많이 구축하기 전에해야합니다.


가지 방법으로 추가해야합니다 .

1. 타겟 설정

프로젝트가 아닌 대상을 클릭하고 Build Phases.

라는 제목 표시 삼각형을 클릭합니다 Link Binary With Libraries. +라이브러리를 추가하려면를 클릭하십시오 .

목록 맨 아래로 스크롤하여을 선택 libxml2.dylib합니다. 그러면 프로젝트에 libxml2 라이브러리가 추가됩니다.

2. 프로젝트 설정

이제 프로젝트에서 찾을 위치를 번 더 알려야합니다 .

을 선택합니다 Build Settings tab.

Linking섹션 까지 아래로 스크롤합니다 . 프로젝트 열 아래에서 Other Linker Flags행을 두 번 클릭하십시오 . 를 클릭하고 목록에 +추가 -lxml2합니다.

아직 더 많이.

같은 탭에서 Search Paths섹션 까지 아래로 스크롤합니다 .

Framework Search Paths의 프로젝트 열 아래 /usr/lib/libxml2.dylib.

에서 Header Search Paths User Header Search Paths 행 추가 $(SDKROOT)/usr/include/libxml2.

마지막 두 경우에서 경로가 디버그 릴리스에 입력되었는지 확인하십시오 .

3. 청소

언더 Product메뉴 선택 Clean.

그런 다음 내가 당신이라면 (그리고 그것을 직시하면 아마 그렇습니다) 나는 Xcode를 그만두고 떠나 버릴 것입니다. 돌아와서 발사하면 잘 가야합니다.


Xcode 6의 경우 다음을 수행해야했습니다.

1) "libxml2.dylib"라이브러리를 내 프로젝트의 TARGET (빌드 단계-> 라이브러리와 바이너리 연결)에 추가합니다.

2) "$ (SDKROOT) / usr / include / libxml2"를 TARGET의 헤더 검색 경로에 추가합니다 (빌드 설정-> 헤더 검색 경로).

그 후에 타겟이 성공적으로 빌드되어야합니다.


또한 /usr/include/libxml2포함 경로 에 추가 해야합니다.


@Matt Ball의 링크를 형성하고,

다음이 도움이된다는 것을 알았습니다.

프로젝트에 libxml2.dylib를 추가해야합니다 (프레임 워크 섹션에 넣지 마십시오). Mac에서는에서 찾을 수 /usr/lib/libxml2.dylib있고 iPhone에서는 /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/lib/libxml2.dylib버전을 원할 것 입니다.

libxml2는 .dylib (친근한 .framework가 아님)이기 때문에 여전히해야 할 일이 하나 더 있습니다. 프로젝트 빌드 설정 ( Project->Edit Project Settings->Build)으로 이동 하여 " Search Paths"을 찾습니다 . "Header Search Paths"에서 Mac의 다음 경로를 추가합니다.

 /usr/include/libxml2 

Ray Wenderlich는이 문제를 해결하는 gdata 사용에 대한 블로그 게시물을 가지고 있습니다. 기본적으로 다음과 같은 간단한 단계 :

XCode에서 Project \ Edit Project Settings를 클릭하고 "All Configurations"가 선택되어 있는지 확인합니다.

검색 경로 \ 헤더 검색 경로 설정을 찾고 / usr / include / libxml2를 목록에 추가하십시오.

마지막으로 Linking \ Other Linker Flags 섹션을 찾아 목록에 -lxml2를 추가합니다.

원본 게시물 : gdataxml로 xml 문서 읽기 및 쓰기


나는 똑같은 것을 발견했고, 최신 Xcode (4.3.x)에 대해 $ (SDKROOT) / usr / include / libxml2를 추가해야했습니다. 또한 내가 몇 시간 동안 계속 돌아 다니는 것은 "PROJECT"가 아니라 "TARGET"을 수정했다는 사실입니다 (Xcode의 새로운 UI는 너무 복잡해서 간과하기 쉽습니다). PROJECT를 수정해야합니다!


또 다른 해결책. 헤더 검색 경로 등의 모든 단계를 수행하고 프로젝트 설정의 프로젝트에서 선택한 구성이 올바른지 확인하십시오. 프로젝트 빌드 설정을 두 번 클릭하면 배포 설정에서 변경 될 수 있지만 "디버그"설정에서 헤더 검색 경로를 추가하려고합니다. 따라서 올바른 설정인지 확인하십시오. 또는 모든 설정 선택


I found that with xCode 4.3.2 I had to enter $(SDKROOT)/usr/include/libxml2 into the Header Search field rather than simply /usr/include/libxml2


As of Mavericks (OS X 10.9) the /usr/include directory is gone. Half of the answers here are obsolete, as the application will not compile until you sort out the include directory.

I solved the problem creating a symbolic link to MacOSX SDK in terminal, using the following command:

sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include /usr/include

The application now compiles again.


I'm not sure what the difference is but add the include path to the project as well as the target.


On Mountain Lion I was facing same issue, which was resolved by adding /usr/include/libxml2 to include paths with flag "recursive", use this if all above is not fruitful.


I had this problem when I reopened a project (which was developed on XCode 3.something on Leopard) after upgrading to Snow Leopard and XCode 3.2. Curious enough, it only affected some kinds of builds (emulator builds went fine, device ones gave me the error). And I have libxml2 at /usr/include, and it indeed contains libxml/tree.h.

Even the magic "Clean" did not work, but "Empty Caches..." under the "XCode" menu (between the Apple logo and File) did the trick (was that menu there in previous versions?). Beats me the reason, but after a clean there were no more complaints regarding libxml/tree.h


Also select "Always Search User Paths" to YES. In XCode 4.3.3 its by default NO


Please follow the following steps

  1. Adding libxml2
    libxml2.dylib can be found on your mac machin at /usr/lib/libxml2.dylib

  2. Change "Header Search Paths"
    Click on [Project Name] (in left panel) -> Project -> Build Settings -> Select All (default is Basic)
    Type Header Search Paths in search box
    Double click on Header Search Paths -> + -> "$(SDKROOT)/usr/include/libxml2"

  3. Add -lxml2 to "Other linker flag"
    Search for "Other Linker Flags" as search in step 2
    click on the "Other Linker Flags" row. Click the "+" and add "-lxml2" to the list.

  4. Change your project type to ARC -> No i.e Automatic Reference Counting to No You can search ARC as per in step 2


Xcode 4.5 I have used The CW's solution entirely. The only exception is that $(SDKROOT)/usr/include/libxml2 didn't work for me, and I had to add "$(SDK_DIR)"/usr/include/libxml2 to my Projects Header Search Paths and User Header Search Paths. After that project builds successfully.

EDIT: I have Google GData project inside my project (called MyProject) (my project uses). GData requires libxml. To build project MyProject successfully, I add "$(SDK_DIR)"/usr/include/libxml2 to Header Search Paths of MyProject and no to Header Search Paths of GData . If I didnt add it to MyProject, project did not build).


I found this visual tutorial useful.


Blockquote Adding libxml2 in Xcode 4.3.x

Adding libxml2 is a big, fat, finicky pain in the ass. If you're going to do it do it before you get too far in building your project.

Here's how.

Target settings

Click on your target (not your project) and select "Build Phases". Click on the reveal triangle titled "Link Binary With Libraries". Click on the "+" to add a library. Scroll to the bottom of the list and select "libxml2.dylib". That adds the libxml2 library 2 your project… but wait.

Project settings

Now you have to tell your project where to look for it three more times.

Select the "Build Settings tab". Scroll down to the "Linking" section. Under your project's columns double click on the "Other Linker Flags" row. Click the "+" and add "-lxml2" to the list.

Still more.

In the same tab, scroll down to the "Search Paths" section. Under your project's column in the "Framework Search Paths" row add "/usr/lib/libxml2.dylib".

In the "Header Search Paths" AND the "User Header Search Paths" row add "$(SDKROOT)/usr/include/libxml2". In those last two cases make sure that path is entered in Debug AND Release.

Then. Under the "Product" Menu select "Clean".

This is working and for Xcode5 too! Thank you!


Don't put libxml2.dylib under frameworks folder put it under root just below the root(Top left blue icon )

Then Click on the Project (TOP Left blue icon) ,GO to Build Settings,in the search box type "Header Search Paths" and then add the this "$(SDKROOT)/usr/include/libxml2"

This code resolve my issue hope it will help you fix this


@Aqib Mumtaz - I got it working by following the instructions in Parris' note above entitled "Adding libxml2 in Xcode 4.3 / 5 / 6". The step in using a Framework Search Path does not work and the compiler complains. Big kudos to that fella anyway!

I am using Xcode 6.2b3

Regardless of the version of Xcode you are using, it is buggy. Don't always assume that compile errors are real. There are many times when it does not follow header search paths and includes clearly listed are not found. Worse, the errors that result tend to point you in different directions so you waste a lot of time dinking around with distractions. With that said...

Recommend baby steps by starting with this exactly...:

  1. create a single window Mac OS X Cocoa project called "Bench Test"
  2. add XpathQuery into your project source directory directly in the Finder
  3. click on the tiny folder icon under the project window's red close button
  4. drag XpathQuery (folder if you contained it) into the project assets on the left of the project window's display
  5. drag /Applications/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libxml2.2.dylib into your project assets, at the bottom. This will add it into your "Build Phases" -> "Link Binary With Libraries" the easy way
  6. click on the "Bench Test" project icon in the project assets column, top of the left
  7. search for "Other Linker Flags" under "Build Settings"
  8. add "-lxml2" (sans "") to "Other Linker Flags" under the "Bench Test" project icon column
  9. search for "header search" under "Build Settings"
  10. add "$(SDKROOT)/usr/include/libxml2" (sans "") to "Header Search Paths" under the "Bench Test" project icon column
  11. add "$(SDKROOT)/usr/include/libxml2" (sans "") to "User Header Search Paths" under the "Bench Test" project icon column

Notes:

  • Mine would not work until I added that search path to both "Header Search Paths" and "User Header Search Paths".
  • To get to the libxml2.2.dylib in the finder, you will need to right click your Xcode icon and select "Show Package Contacts" (editorial: what a hack.. cramming all that garbage into the app)
  • Be prepared to change the linked libxml2.2.dylib. The one inside Xcode is intentionally used to ensure that Xcode gets something it knows about and in theory was tested. You may want to use the dylib in the system later (read up in this thread)
  • As I am using Xcode 6.2b3, I may have a newer libxml2.2.dylib. Yours could be named slightly different. Just search the folder for something that starts with "libxml" and ends with ".dylib" and that should be it. There may also be an alias like "libxml2.dylib". Don't use that right away as resolving an alias adds another variable into the Xcode "what could have bugs" equation.
  • For sanity sake, I make aliases of the external libraries, rename them to indicate which one they are, and keep them at the same level as the project file in the Finder. If they change location, change name, etc, the alias will have in it's Get Info, the original file's full path for later detective work to get the project compiling and linking again. (symlinks break too easy and are not natural to the Mac)
  • Last thing, and very important, see http://www.cocoawithlove.com/2008/10/using-libxml2-for-parsing-and-xpath.html where you can download XpathQuery and get some more goodness.

hope this helps.

If you happen to be developing something for Veterans, oh say an iPhone / iPad or Mac app, and are working against something called "MDWS" or "VIA" which are SOAP based interfaces to the medical record system... please contact me


I solved in three steps inXcode 8.0 + Unit Test Project

1) I added libxml file to the Build Phases.follow this link

2) I added Other Linker Flags as -ObjC (For both project and test project targets)

3) I setup Header Search Path as "${SDKROOT}/usr/include/libxml2" (Don't forget double quote in either side) (For both project and test project targets)

One of them will solve the issue. If not you have to apply all three of the above.


i tought i added wrongly, then i realize the problem is it not support arc, so check the support one here, life saver -> http://www.michaelbabiy.com/arc-compliant-gdataxml-library/

참고URL : https://stackoverflow.com/questions/1428847/libxml-tree-h-no-such-file-or-directory

반응형