在OSX上使用C编译或使用libxml

jar*_*ryd 3 c macos libxml2

如果我想编译使用libxml的ac源文件,如何在mac osx上设置libxml,以便我的源文件能够正确编译并准备好运行?

我一直在使用XCode,但是已经切换到TextMate&Terminal,如果我想使用libxml,我是否需要创建一个makefile,或者这将如何工作?

谢谢

编辑:

我使用当前的导入

#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
Run Code Online (Sandbox Code Playgroud)

Mat*_* B. 5

10.6上的libxml2发行版的标头位于其中/usr/include/libxml2/.不幸的是,只是该/usr/include部分位于系统默认标题搜索路径中.因此,您需要在命令行中明确地包含它(或者#includes还包括其他libxml2文件夹).图书馆本身就像往常一样/usr/lib/libxml2.dylib.

因此,使用以下命令编译您的程序:

gcc source.c -I/usr/include/libxml2 -lxml2 -o output
Run Code Online (Sandbox Code Playgroud)