在VC2005/08和Mac OS环境下编译LibXML2
我正在编写一个 C 应用程序,它使用 LibXML2 进行 XML 解析和验证。在 Linux 中编译它非常简单,但在 Windows 和 Mac 中编译它似乎很严格。
对于Windows,我使用的是VC2005/08(我基本上都有两个副本,因此会使用更容易的那个)。我需要将我的应用程序与 Libxml2 和其他库一起编译。 最重要的是,我需要使用 MSVCRT.DLL 来编译它,而不是使用其他 CRT DLL 库(如 MSVCRT71.dll 等)...
我也需要为 Mac Os 构建它。
请建议我该怎么做?
I am writing a C application which uses LibXML2 for XML parsing and Validation. Compiling it in Linux was pretty easy, though compiling it in Windows and Mac seems to be exacting.
For Windows, I am using VC2005/08 ( I basically have both the copies, hence would use on which ever its easier). I need to compile my application along with Libxml2 and other libraries. Most Importantly I need to compile this with MSVCRT.DLL and not with other CRT DLL Libraries like MSVCRT71.dll etc...
I need to build this for Mac Os as well.
Please advice on how should I go about this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
曾几何时,我设置了一个 Visual C++ 2005 项目文件来从源代码构建 libxml2。令人惊讶的是,我保留了关于我如何做其中一些事情的说明。这是针对 2.7.4 的,因此当前版本可能有所不同。
首先你必须运行配置脚本;我执行了
cscript configure.js iconv=no
因为我不想让另一个依赖项 (iconv) 使事情变得复杂。这会生成一些头文件,定义哪些选项可用于构建。然后您需要创建一个项目文件并将所有 libxml2 源文件添加到其中。我将我的设置为与静态 C 运行时链接的静态库,但您可能希望根据需要更改它。我必须向我的项目文件添加一些定义,以便它能够以某种方式构建;查看我的项目文件,我看到
_REENTRANT;HAVE_WIN32_THREADS
。我不记得这些是什么意思,但我可能是从 makefile 中收集到的。这就是它的全部内容;配置、添加文件并设置一些定义。
Once upon a time I setup a Visual C++ 2005 project file to build libxml2 from source. Amazingly I kept instructions on how I did some of it. This is for 2.7.4, so it may be different for the current version.
First you have to run the configure script; I did
cscript configure.js iconv=no
as I didn't want to complicate things with another dependency (iconv). This generates some header files that define what options are available for the build.Then you need to create a project file and add all the libxml2 source files to it. I set mine up as a static library that linked with the static C runtime, though you may want to change this for your needs. I had to add some definitions to my project file so that it would build a certain way; looking at my project file I see
_REENTRANT;HAVE_WIN32_THREADS
. I don't remember what these mean, but I probably gleaned them from the makefile.That's really all there is to it; configure, add the files, and set some defines.