objective-c libxml/tree.h 没有这样的文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1428847/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 22:12:53  来源:igfitidea点击:

libxml/tree.h no such file or directory

objective-ciphonexcodelibxml2

提问by Sagar R. Kothari

I am getting following errors.

我收到以下错误。

libxml/tree.h no such file or directory

libxml/tree.h 没有这样的文件或目录

I have already added libxml2.dylibto my project, however I am getting this type of trouble. Please help me.

我已经添加libxml2.dylib到我的项目中,但是我遇到了这种类型的麻烦。请帮我。

回答by Matt Ball

Follow the directions here, under "Setting up your project file."

按照此处的说明操作,在“设置您的项目文件”下。

Setting up your project file

You need to add libxml2.dylib to your project (don't put it in the Frameworks section). On the Mac, you'll find it at /usr/lib/libxml2.dyliband for the iPhone, you'll want the /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/usr/lib/libxml2.dylibversion.

Since libxml2 is a .dylib (not a nice friendly .framework) we still have one more thing to do. Go to the Project build settings (Project->Edit Project Settings->Build) and find the "Search Paths". In "Header Search Paths" add the following path:

$(SDKROOT)/usr/include/libxml2

设置您的项目文件

您需要将 libxml2.dylib 添加到您的项目中(不要将其放在 Frameworks 部分)。在 Mac 上,你会/usr/lib/libxml2.dylib在 iPhone 上找到它,你会想要这个 /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/usr/lib/libxml2.dylib版本。

由于 libxml2 是一个 .dylib(不是一个友好的 .framework),我们还有一件事要做。转到项目构建设置(项目->编辑项目设置->构建)并找到“搜索路径”。在“标题搜索路径”中添加以下路径:

$(SDKROOT)/usr/include/libxml2


Also see the OP's answer.

另请参阅OP 的回答

回答by e.w. parris

Adding libxml2 in Xcode 4.3 / 5 / 6

在 Xcode 4.3 / 5 / 6 中添加 libxml2

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.

添加 libxml2 是一个巨大的、肥胖的、挑剔的痛苦。如果您打算这样做,请在构建项目的过程中走得太远。



You need to add it in two ways:

您需要通过两种方式添加它:

1. Target settings

1. 目标设置

Click on your target (not your project) and select Build Phases.

单击您的目标(不是您的项目)并选择Build Phases

Click on the reveal triangletitled Link Binary With Libraries. Click on the +to add a library.

单击标题为的显示三角形Link Binary With Libraries。单击+以添加库。

Scroll to the bottom of the list and select libxml2.dylib. That adds the libxml2 library to your project.

滚动到列表底部并选择libxml2.dylib。这会将 libxml2 库添加到您的项目中。

2. Project settings

2. 项目设置

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

现在,您必须再三次告诉您的项目在哪里寻找它。

Select the Build Settings tab.

选择Build Settings tab.

Scroll down to the Linkingsection. Under your projects columns double click on the Other Linker Flagsrow. Click the +and add -lxml2to the list.

向下滚动到该Linking部分。在您的项目列下双击该Other Linker Flags行。单击+并添加-lxml2到列表中。

Still more.

还有更多。

In the same tab, scroll down to the Search Pathssection.

在同一选项卡中,向下滚动到该Search Paths部分。

Under your projects column in the Framework Search Pathsrow add /usr/lib/libxml2.dylib.

Framework Search Paths在行中的项目列下添加/usr/lib/libxml2.dylib.

In the Header Search Pathsandthe User Header Search Pathsrow add $(SDKROOT)/usr/include/libxml2.

Header Search PathsUser Header Search Paths行添加$(SDKROOT)/usr/include/libxml2

In those last two cases make sure that path is entered in Debug andRelease.

在后两种情况下,请确保在 DebugRelease 中输入路径。

3. Clean

3. 清洁

Under the ProductMenu select Clean.

Product菜单下选择Clean

Then, if I were you (and lets face it, I probably am) I'd quit Xcode and walk away. When you come back and launch you should be good to go.

然后,如果我是你(让我们面对现实,我可能是)我会退出 Xcode 并走开。当您返回并启动时,您应该很高兴。

回答by Andy Shephard

For Xcode 6, I had to do the following:

对于 Xcode 6,我必须执行以下操作:

1) add the "libxml2.dylib" library to my project's TARGET (Build Phases -> Link Binary With Libraries)

1)将“libxml2.dylib”库添加到我项目的目标(构建阶段->链接二进制库)

2) add "$(SDKROOT)/usr/include/libxml2" to the Header Search Paths on the TARGET (Build Settings -> Header Search Paths)

2)将“$(SDKROOT)/usr/include/libxml2”添加到TARGET上的Header Search Paths(Build Settings -> Header Search Paths)

After this, the target should build successfully.

在此之后,目标应该成功构建。

回答by Michael Krelin - hacker

You also need to add /usr/include/libxml2to your include path.

您还需要添加/usr/include/libxml2到您的包含路径。

回答by Sagar R. Kothari

Form the link of @Matt Ball,

形成@Matt Ball 的链接,

I found following helpful to me.

我发现以下对我有帮助。

You need to add libxml2.dylib to your project (don't put it in the Frameworks section). On the Mac, you'll find it at /usr/lib/libxml2.dyliband for the iPhone, you'll want the /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/lib/libxml2.dylibversion.

您需要将 libxml2.dylib 添加到您的项目中(不要将其放在 Frameworks 部分)。在 Mac 上,你会/usr/lib/libxml2.dylib在 iPhone 上找到它,你会想要这个/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/lib/libxml2.dylib版本。

Since libxml2 is a .dylib (not a nice friendly .framework) we still have one more thing to do. Go to the Project build settings (Project->Edit Project Settings->Build) and find the "Search Paths". In "Header Search Paths" add the following path on the Mac:

由于 libxml2 是一个 .dylib(不是一个友好的 .framework),我们还有一件事要做。转到项目构建设置 ( Project->Edit Project Settings->Build) 并找到“ Search Paths”。在 Mac 上的“标题搜索路径”中添加以下路径:

 /usr/include/libxml2 

回答by bennythemink

Ray Wenderlich has a blog post about using gdata that solves this problem. Basically these simple steps:

Ray Wenderlich 有一篇关于使用 gdata 解决这个问题的博客文章。基本上这些简单的步骤:

In XCode, click Project\Edit Project Settings and make sure “All Configurations” are checked.

在 XCode 中,单击 Project\Edit Project Settings 并确保选中“All Configurations”。

Find the Search Paths\Header Search Paths setting and add /usr/include/libxml2 to the list.

找到 Search Paths\Header Search Paths 设置并将 /usr/include/libxml2 添加到列表中。

Finally, find the Linking\Other Linker Flags section and add -lxml2 to the list.

最后,找到 Linking\Other Linker Flags 部分并将 -lxml2 添加到列表中。

original post: read and write xml documents with gdataxml

原帖:用gdataxml读写xml文档

回答by Mike

I found the same, I had to add $(SDKROOT)/usr/include/libxml2 for the latest Xcode (4.3.x). ALSO, what kept me circling around for hours is the fact that I was modifying the "TARGET" and not the "PROJECT" (the new UI of Xcode is so intricate that its easy to overlook this). You need to modify the PROJECT!

我发现了同样的情况,我必须为最新的 Xcode (4.3.x) 添加 $(SDKROOT)/usr/include/libxml2。此外,让我绕了几个小时的是我正在修改“目标”而不是“项目”(Xcode 的新 UI 非常复杂,很容易忽略这一点)。您需要修改项目!

回答by S.P.

Another solution. do all the steps in header search path etc. and make sure your selected configuration in project in Project settings is the correct one. When you double click on project build settings ,you may be changing in Distribution settings, But you are trying to add header search path in "Debug" settings. So make sure you are in correct settings. or choose all settings

另一种解决方案。执行标题搜索路径等中的所有步骤,并确保您在项目设置中的项目中选择的配置是正确的。当您双击项目构建设置时,您可能会在分发设置中进行更改,但是您正在尝试在“调试”设置中添加标题搜索路径。因此,请确保您处于正确的设置中。或选择所有设置

回答by fsharp

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

我发现使用 xCode 4.3.2 我必须在 Header Search 字段中输入 $(SDKROOT)/usr/include/libxml2 而不是简单的 /usr/include/libxml2

回答by Legoless

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.

从 Mavericks (OS X 10.9) 开始, /usr/include 目录消失了。这里有一半的答案已经过时,因为在您整理好包含目录之前,应用程序不会编译。

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

我使用以下命令解决了在终端中创建指向 MacOSX SDK 的符号链接的问题:

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.

应用程序现在再次编译。