518 lines
		
	
	
		
			31 KiB
		
	
	
	
		
			HTML
		
	
	
			
		
		
	
	
			518 lines
		
	
	
		
			31 KiB
		
	
	
	
		
			HTML
		
	
	
<html>
 | 
						|
<head>
 | 
						|
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
 | 
						|
<title>Installation</title>
 | 
						|
<link rel="stylesheet" href="../pugixml.css" type="text/css">
 | 
						|
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
 | 
						|
<link rel="home" href="../manual.html" title="pugixml 1.5">
 | 
						|
<link rel="up" href="../manual.html" title="pugixml 1.5">
 | 
						|
<link rel="prev" href="../manual.html" title="pugixml 1.5">
 | 
						|
<link rel="next" href="dom.html" title="Document object model">
 | 
						|
</head>
 | 
						|
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 | 
						|
<table width="100%"><tr>
 | 
						|
<td>
 | 
						|
<a href="http://pugixml.org/">pugixml 1.5</a> manual |
 | 
						|
		<a href="../manual.html">Overview</a> |
 | 
						|
		<b>Installation</b> |
 | 
						|
		Document:
 | 
						|
		<a href="dom.html">Object model</a> · <a href="loading.html">Loading</a> · <a href="access.html">Accessing</a> · <a href="modify.html">Modifying</a> · <a href="saving.html">Saving</a> |
 | 
						|
		<a href="xpath.html">XPath</a> |
 | 
						|
		<a href="apiref.html">API Reference</a> |
 | 
						|
		<a href="toc.html">Table of Contents</a>
 | 
						|
</td>
 | 
						|
<td width="*" align="right"><div class="spirit-nav">
 | 
						|
<a accesskey="p" href="../manual.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../manual.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../manual.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="dom.html"><img src="../images/next.png" alt="Next"></a>
 | 
						|
</div></td>
 | 
						|
</tr></table>
 | 
						|
<hr>
 | 
						|
<div class="section">
 | 
						|
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
 | 
						|
<a name="manual.install"></a><a class="link" href="install.html" title="Installation"> Installation</a>
 | 
						|
</h2></div></div></div>
 | 
						|
<div class="toc"><dl class="toc">
 | 
						|
<dt><span class="section"><a href="install.html#manual.install.getting"> Getting pugixml</a></span></dt>
 | 
						|
<dd><dl>
 | 
						|
<dt><span class="section"><a href="install.html#manual.install.getting.source"> Source distributions</a></span></dt>
 | 
						|
<dt><span class="section"><a href="install.html#manual.install.getting.git"> Git repository</a></span></dt>
 | 
						|
<dt><span class="section"><a href="install.html#manual.install.getting.subversion"> Subversion repository</a></span></dt>
 | 
						|
</dl></dd>
 | 
						|
<dt><span class="section"><a href="install.html#manual.install.building"> Building pugixml</a></span></dt>
 | 
						|
<dd><dl>
 | 
						|
<dt><span class="section"><a href="install.html#manual.install.building.embed"> Building pugixml as
 | 
						|
        a part of another static library/executable</a></span></dt>
 | 
						|
<dt><span class="section"><a href="install.html#manual.install.building.static"> Building pugixml as
 | 
						|
        a standalone static library</a></span></dt>
 | 
						|
<dt><span class="section"><a href="install.html#manual.install.building.shared"> Building pugixml as
 | 
						|
        a standalone shared library</a></span></dt>
 | 
						|
<dt><span class="section"><a href="install.html#manual.install.building.header"> Using pugixml in header-only
 | 
						|
        mode</a></span></dt>
 | 
						|
<dt><span class="section"><a href="install.html#manual.install.building.config"> Additional configuration
 | 
						|
        options</a></span></dt>
 | 
						|
</dl></dd>
 | 
						|
<dt><span class="section"><a href="install.html#manual.install.portability"> Portability</a></span></dt>
 | 
						|
</dl></div>
 | 
						|
<div class="section">
 | 
						|
<div class="titlepage"><div><div><h3 class="title">
 | 
						|
<a name="manual.install.getting"></a><a class="link" href="install.html#manual.install.getting" title="Getting pugixml"> Getting pugixml</a>
 | 
						|
</h3></div></div></div>
 | 
						|
<p>
 | 
						|
        pugixml is distributed in source form. You can either download a source distribution
 | 
						|
        or clone the Git repository.
 | 
						|
      </p>
 | 
						|
<div class="section">
 | 
						|
<div class="titlepage"><div><div><h4 class="title">
 | 
						|
<a name="manual.install.getting.source"></a><a class="link" href="install.html#manual.install.getting.source" title="Source distributions"> Source distributions</a>
 | 
						|
</h4></div></div></div>
 | 
						|
<p>
 | 
						|
          You can download the latest source distribution via one of the following
 | 
						|
          links:
 | 
						|
        </p>
 | 
						|
<pre class="programlisting"><a href="https://github.com/zeux/pugixml/releases/download/v1.5/pugixml-1.5.zip" target="_top">https://github.com/zeux/pugixml/releases/download/v1.5/pugixml-1.5.zip</a>
 | 
						|
<a href="https://github.com/zeux/pugixml/releases/download/v1.5/pugixml-1.5.tar.gz" target="_top">https://github.com/zeux/pugixml/releases/download/v1.5/pugixml-1.5.tar.gz</a>
 | 
						|
</pre>
 | 
						|
<p>
 | 
						|
          The distribution contains library source, documentation (the manual you're
 | 
						|
          reading now and the quick start guide) and some code examples. After downloading
 | 
						|
          the distribution, install pugixml by extracting all files from the compressed
 | 
						|
          archive. The files have different line endings depending on the archive
 | 
						|
          format - <code class="filename">.zip</code> archive has Windows line endings, <code class="filename">.tar.gz</code> archive has Unix
 | 
						|
          line endings. Otherwise the files in both archives are identical.
 | 
						|
        </p>
 | 
						|
<p>
 | 
						|
          If you need an older version, you can download it from the <a href="https://github.com/zeux/pugixml/releases" target="_top">version
 | 
						|
          archive</a>.
 | 
						|
        </p>
 | 
						|
</div>
 | 
						|
<div class="section">
 | 
						|
<div class="titlepage"><div><div><h4 class="title">
 | 
						|
<a name="manual.install.getting.git"></a><a class="link" href="install.html#manual.install.getting.git" title="Git repository"> Git repository</a>
 | 
						|
</h4></div></div></div>
 | 
						|
<p>
 | 
						|
          The Git repository is located at <a href="https://github.com/zeux/pugixml/" target="_top">https://github.com/zeux/pugixml/</a>.
 | 
						|
          There is a Git tag "v{version}" for each version; also there
 | 
						|
          is the "latest" tag, which always points to the latest stable
 | 
						|
          release.
 | 
						|
        </p>
 | 
						|
<p>
 | 
						|
          For example, to checkout the current version, you can use this command:
 | 
						|
        </p>
 | 
						|
<pre class="programlisting">git clone https://github.com/zeux/pugixml
 | 
						|
cd pugixml
 | 
						|
git checkout v1.5
 | 
						|
</pre>
 | 
						|
<p>
 | 
						|
          The repository contains library source, documentation, code examples and
 | 
						|
          full unit test suite.
 | 
						|
        </p>
 | 
						|
<p>
 | 
						|
          Use latest version tag if you want to automatically get new versions. Use
 | 
						|
          other tags if you want to switch to new versions only explicitly. Also
 | 
						|
          please note that the master branch contains the work-in-progress version
 | 
						|
          of the code; while this means that you can get new features and bug fixes
 | 
						|
          from master without waiting for a new release, this also means that occasionally
 | 
						|
          the code can be broken in some configurations.
 | 
						|
        </p>
 | 
						|
</div>
 | 
						|
<div class="section">
 | 
						|
<div class="titlepage"><div><div><h4 class="title">
 | 
						|
<a name="manual.install.getting.subversion"></a><a class="link" href="install.html#manual.install.getting.subversion" title="Subversion repository"> Subversion repository</a>
 | 
						|
</h4></div></div></div>
 | 
						|
<p>
 | 
						|
          You can access the Git repository via Subversion using <a href="https://github.com/zeux/pugixml" target="_top">https://github.com/zeux/pugixml</a>
 | 
						|
          URL. For example, to checkout the current version, you can use this command:
 | 
						|
        </p>
 | 
						|
<pre class="programlisting">svn checkout https://github.com/zeux/pugixml/tags/v1.5 pugixml</pre>
 | 
						|
</div>
 | 
						|
</div>
 | 
						|
<div class="section">
 | 
						|
<div class="titlepage"><div><div><h3 class="title">
 | 
						|
<a name="manual.install.building"></a><a class="link" href="install.html#manual.install.building" title="Building pugixml"> Building pugixml</a>
 | 
						|
</h3></div></div></div>
 | 
						|
<p>
 | 
						|
        pugixml is distributed in source form without any pre-built binaries; you
 | 
						|
        have to build them yourself.
 | 
						|
      </p>
 | 
						|
<p>
 | 
						|
        The complete pugixml source consists of three files - one source file, <code class="filename">pugixml.cpp</code>,
 | 
						|
        and two header files, <code class="filename">pugixml.hpp</code> and <code class="filename">pugiconfig.hpp</code>. <code class="filename">pugixml.hpp</code> is the primary
 | 
						|
        header which you need to include in order to use pugixml classes/functions;
 | 
						|
        <code class="filename">pugiconfig.hpp</code> is a supplementary configuration file (see <a class="xref" href="install.html#manual.install.building.config" title="Additional configuration options"> Additional configuration
 | 
						|
        options</a>).
 | 
						|
        The rest of this guide assumes that <code class="filename">pugixml.hpp</code> is either in the current directory
 | 
						|
        or in one of include directories of your projects, so that <code class="computeroutput"><span class="preprocessor">#include</span> <span class="string">"pugixml.hpp"</span></code>
 | 
						|
        can find the header; however you can also use relative path (i.e. <code class="computeroutput"><span class="preprocessor">#include</span> <span class="string">"../libs/pugixml/src/pugixml.hpp"</span></code>)
 | 
						|
        or include directory-relative path (i.e. <code class="computeroutput"><span class="preprocessor">#include</span>
 | 
						|
        <span class="special"><</span><span class="identifier">xml</span><span class="special">/</span><span class="identifier">thirdparty</span><span class="special">/</span><span class="identifier">pugixml</span><span class="special">/</span><span class="identifier">src</span><span class="special">/</span><span class="identifier">pugixml</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>).
 | 
						|
      </p>
 | 
						|
<div class="section">
 | 
						|
<div class="titlepage"><div><div><h4 class="title">
 | 
						|
<a name="manual.install.building.embed"></a><a class="link" href="install.html#manual.install.building.embed" title="Building pugixml as a part of another static library/executable"> Building pugixml as
 | 
						|
        a part of another static library/executable</a>
 | 
						|
</h4></div></div></div>
 | 
						|
<p>
 | 
						|
          The easiest way to build pugixml is to compile the source file, <code class="filename">pugixml.cpp</code>,
 | 
						|
          along with the existing library/executable. This process depends on the
 | 
						|
          method of building your application; for example, if you're using Microsoft
 | 
						|
          Visual Studio<a href="#ftn.trademarks" class="footnote" name="trademarks"><sup class="footnote">[1]</sup></a>, Apple Xcode, Code::Blocks or any other IDE, just add <code class="filename">pugixml.cpp</code> to
 | 
						|
          one of your projects.
 | 
						|
        </p>
 | 
						|
<p>
 | 
						|
          If you're using Microsoft Visual Studio and the project has precompiled
 | 
						|
          headers turned on, you'll see the following error messages:
 | 
						|
        </p>
 | 
						|
<pre class="programlisting">pugixml.cpp(3477) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?</pre>
 | 
						|
<p>
 | 
						|
          The correct way to resolve this is to disable precompiled headers for <code class="filename">pugixml.cpp</code>;
 | 
						|
          you have to set "Create/Use Precompiled Header" option (Properties
 | 
						|
          dialog -> C/C++ -> Precompiled Headers -> Create/Use Precompiled
 | 
						|
          Header) to "Not Using Precompiled Headers". You'll have to do
 | 
						|
          it for all project configurations/platforms (you can select Configuration
 | 
						|
          "All Configurations" and Platform "All Platforms" before
 | 
						|
          editing the option):
 | 
						|
        </p>
 | 
						|
<div class="informaltable"><table class="table">
 | 
						|
<colgroup><col></colgroup>
 | 
						|
<tbody><tr><td>
 | 
						|
                  <p>
 | 
						|
                    <a href="../images/vs2005_pch1.png" target="_top"><span class="inlinemediaobject"><img src="../images/vs2005_pch1_thumb.png" alt="vs2005_pch1_thumb"></span></a> <span class="inlinemediaobject"><img src="../images/next.png" alt="next"></span> <a href="../images/vs2005_pch2.png" target="_top"><span class="inlinemediaobject"><img src="../images/vs2005_pch2_thumb.png" alt="vs2005_pch2_thumb"></span></a> <span class="inlinemediaobject"><img src="../images/next.png" alt="next"></span> <a href="../images/vs2005_pch3.png" target="_top"><span class="inlinemediaobject"><img src="../images/vs2005_pch3_thumb.png" alt="vs2005_pch3_thumb"></span></a> <span class="inlinemediaobject"><img src="../images/next.png" alt="next"></span> <a href="../images/vs2005_pch4.png" target="_top"><span class="inlinemediaobject"><img src="../images/vs2005_pch4_thumb.png" alt="vs2005_pch4_thumb"></span></a>
 | 
						|
                  </p>
 | 
						|
                </td></tr></tbody>
 | 
						|
</table></div>
 | 
						|
</div>
 | 
						|
<div class="section">
 | 
						|
<div class="titlepage"><div><div><h4 class="title">
 | 
						|
<a name="manual.install.building.static"></a><a class="link" href="install.html#manual.install.building.static" title="Building pugixml as a standalone static library"> Building pugixml as
 | 
						|
        a standalone static library</a>
 | 
						|
</h4></div></div></div>
 | 
						|
<p>
 | 
						|
          It's possible to compile pugixml as a standalone static library. This process
 | 
						|
          depends on the method of building your application; pugixml distribution
 | 
						|
          comes with project files for several popular IDEs/build systems. There
 | 
						|
          are project files for Apple XCode3, Code::Blocks, Codelite, Microsoft Visual
 | 
						|
          Studio 2005, 2008, 2010, and configuration scripts for CMake and premake4.
 | 
						|
          You're welcome to submit project files/build scripts for other software;
 | 
						|
          see <a class="xref" href="../manual.html#manual.overview.feedback" title="Feedback"> Feedback</a>.
 | 
						|
        </p>
 | 
						|
<p>
 | 
						|
          There are two projects for each version of Microsoft Visual Studio: one
 | 
						|
          for dynamically linked CRT, which has a name like <code class="filename">pugixml_vs2008.vcproj</code>,
 | 
						|
          and another one for statically linked CRT, which has a name like <code class="filename">pugixml_vs2008_static.vcproj</code>.
 | 
						|
          You should select the version that matches the CRT used in your application;
 | 
						|
          the default option for new projects created by Microsoft Visual Studio
 | 
						|
          is dynamically linked CRT, so unless you changed the defaults, you should
 | 
						|
          use the version with dynamic CRT (i.e. <code class="filename">pugixml_vs2008.vcproj</code> for Microsoft
 | 
						|
          Visual Studio 2008).
 | 
						|
        </p>
 | 
						|
<p>
 | 
						|
          In addition to adding pugixml project to your workspace, you'll have to
 | 
						|
          make sure that your application links with pugixml library. If you're using
 | 
						|
          Microsoft Visual Studio 2005/2008, you can add a dependency from your application
 | 
						|
          project to pugixml one. If you're using Microsoft Visual Studio 2010, you'll
 | 
						|
          have to add a reference to your application project instead. For other
 | 
						|
          IDEs/systems, consult the relevant documentation.
 | 
						|
        </p>
 | 
						|
<div class="informaltable"><table class="table">
 | 
						|
<colgroup>
 | 
						|
<col>
 | 
						|
<col>
 | 
						|
</colgroup>
 | 
						|
<thead><tr>
 | 
						|
<th>
 | 
						|
                  <p>
 | 
						|
                    Microsoft Visual Studio 2005/2008
 | 
						|
                  </p>
 | 
						|
                </th>
 | 
						|
<th>
 | 
						|
                  <p>
 | 
						|
                    Microsoft Visual Studio 2010
 | 
						|
                  </p>
 | 
						|
                </th>
 | 
						|
</tr></thead>
 | 
						|
<tbody><tr>
 | 
						|
<td>
 | 
						|
                  <p>
 | 
						|
                    <a href="../images/vs2005_link1.png" target="_top"><span class="inlinemediaobject"><img src="../images/vs2005_link1_thumb.png" alt="vs2005_link1_thumb"></span></a> <span class="inlinemediaobject"><img src="../images/next.png" alt="next"></span> <a href="../images/vs2005_link2.png" target="_top"><span class="inlinemediaobject"><img src="../images/vs2005_link2_thumb.png" alt="vs2005_link2_thumb"></span></a>
 | 
						|
                  </p>
 | 
						|
                </td>
 | 
						|
<td>
 | 
						|
                  <p>
 | 
						|
                    <a href="../images/vs2010_link1.png" target="_top"><span class="inlinemediaobject"><img src="../images/vs2010_link1_thumb.png" alt="vs2010_link1_thumb"></span></a> <span class="inlinemediaobject"><img src="../images/next.png" alt="next"></span> <a href="../images/vs2010_link2.png" target="_top"><span class="inlinemediaobject"><img src="../images/vs2010_link2_thumb.png" alt="vs2010_link2_thumb"></span></a>
 | 
						|
                  </p>
 | 
						|
                </td>
 | 
						|
</tr></tbody>
 | 
						|
</table></div>
 | 
						|
</div>
 | 
						|
<div class="section">
 | 
						|
<div class="titlepage"><div><div><h4 class="title">
 | 
						|
<a name="manual.install.building.shared"></a><a class="link" href="install.html#manual.install.building.shared" title="Building pugixml as a standalone shared library"> Building pugixml as
 | 
						|
        a standalone shared library</a>
 | 
						|
</h4></div></div></div>
 | 
						|
<p>
 | 
						|
          It's possible to compile pugixml as a standalone shared library. The process
 | 
						|
          is usually similar to the static library approach; however, no preconfigured
 | 
						|
          projects/scripts are included into pugixml distribution, so you'll have
 | 
						|
          to do it yourself. Generally, if you're using GCC-based toolchain, the
 | 
						|
          process does not differ from building any other library as DLL (adding
 | 
						|
          -shared to compilation flags should suffice); if you're using MSVC-based
 | 
						|
          toolchain, you'll have to explicitly mark exported symbols with a declspec
 | 
						|
          attribute. You can do it by defining <a class="link" href="install.html#PUGIXML_API">PUGIXML_API</a>
 | 
						|
          macro, i.e. via <code class="filename">pugiconfig.hpp</code>:
 | 
						|
        </p>
 | 
						|
<pre class="programlisting"><span class="preprocessor">#ifdef</span> <span class="identifier">_DLL</span>
 | 
						|
<span class="preprocessor">#define</span> <span class="identifier">PUGIXML_API</span> <span class="identifier">__declspec</span><span class="special">(</span><span class="identifier">dllexport</span><span class="special">)</span>
 | 
						|
<span class="preprocessor">#else</span>
 | 
						|
<span class="preprocessor">#define</span> <span class="identifier">PUGIXML_API</span> <span class="identifier">__declspec</span><span class="special">(</span><span class="identifier">dllimport</span><span class="special">)</span>
 | 
						|
<span class="preprocessor">#endif</span>
 | 
						|
</pre>
 | 
						|
<div class="caution"><table border="0" summary="Caution">
 | 
						|
<tr>
 | 
						|
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../images/caution.png"></td>
 | 
						|
<th align="left">Caution</th>
 | 
						|
</tr>
 | 
						|
<tr><td align="left" valign="top"><p>
 | 
						|
            If you're using STL-related functions, you should use the shared runtime
 | 
						|
            library to ensure that a single heap is used for STL allocations in your
 | 
						|
            application and in pugixml; in MSVC, this means selecting the 'Multithreaded
 | 
						|
            DLL' or 'Multithreaded Debug DLL' to 'Runtime library' property (/MD
 | 
						|
            or /MDd linker switch). You should also make sure that your runtime library
 | 
						|
            choice is consistent between different projects.
 | 
						|
          </p></td></tr>
 | 
						|
</table></div>
 | 
						|
</div>
 | 
						|
<a name="PUGIXML_HEADER_ONLY"></a><div class="section">
 | 
						|
<div class="titlepage"><div><div><h4 class="title">
 | 
						|
<a name="manual.install.building.header"></a><a class="link" href="install.html#manual.install.building.header" title="Using pugixml in header-only mode"> Using pugixml in header-only
 | 
						|
        mode</a>
 | 
						|
</h4></div></div></div>
 | 
						|
<p>
 | 
						|
          It's possible to use pugixml in header-only mode. This means that all source
 | 
						|
          code for pugixml will be included in every translation unit that includes
 | 
						|
          <code class="filename">pugixml.hpp</code>. This is how most of Boost and STL libraries work.
 | 
						|
        </p>
 | 
						|
<p>
 | 
						|
          Note that there are advantages and drawbacks of this approach. Header mode
 | 
						|
          may improve tree traversal/modification performance (because many simple
 | 
						|
          functions will be inlined), if your compiler toolchain does not support
 | 
						|
          link-time optimization, or if you have it turned off (with link-time optimization
 | 
						|
          the performance should be similar to non-header mode). However, since compiler
 | 
						|
          now has to compile pugixml source once for each translation unit that includes
 | 
						|
          it, compilation times may increase noticeably. If you want to use pugixml
 | 
						|
          in header mode but do not need XPath support, you can consider disabling
 | 
						|
          it by using <a class="link" href="install.html#PUGIXML_NO_XPATH">PUGIXML_NO_XPATH</a> define
 | 
						|
          to improve compilation time.
 | 
						|
        </p>
 | 
						|
<p>
 | 
						|
          Enabling header-only mode is a two-step process:
 | 
						|
        </p>
 | 
						|
<div class="orderedlist"><ol class="orderedlist" type="1">
 | 
						|
<li class="listitem">
 | 
						|
              You have to define <code class="computeroutput"><span class="identifier">PUGIXML_HEADER_ONLY</span></code>
 | 
						|
            </li>
 | 
						|
<li class="listitem">
 | 
						|
              You have to include <code class="filename">pugixml.cpp</code> whenever you include pugixml.hpp
 | 
						|
            </li>
 | 
						|
</ol></div>
 | 
						|
<p>
 | 
						|
          Both of these are best done via <code class="filename">pugiconfig.hpp</code> like this:
 | 
						|
        </p>
 | 
						|
<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">PUGIXML_HEADER_ONLY</span>
 | 
						|
<span class="preprocessor">#include</span> <span class="string">"pugixml.cpp"</span>
 | 
						|
</pre>
 | 
						|
<p>
 | 
						|
          Note that it is safe to compile <code class="filename">pugixml.cpp</code> if <code class="computeroutput"><span class="identifier">PUGIXML_HEADER_ONLY</span></code>
 | 
						|
          is defined - so if you want to i.e. use header-only mode only in Release
 | 
						|
          configuration, you can include pugixml.cpp in your project (see <a class="xref" href="install.html#manual.install.building.embed" title="Building pugixml as a part of another static library/executable"> Building pugixml as
 | 
						|
        a part of another static library/executable</a>),
 | 
						|
          and conditionally enable header-only mode in <code class="filename">pugiconfig.hpp</code>, i.e.:
 | 
						|
        </p>
 | 
						|
<pre class="programlisting"><span class="preprocessor">#ifndef</span> <span class="identifier">_DEBUG</span>
 | 
						|
    <span class="preprocessor">#define</span> <span class="identifier">PUGIXML_HEADER_ONLY</span>
 | 
						|
    <span class="preprocessor">#include</span> <span class="string">"pugixml.cpp"</span>
 | 
						|
<span class="preprocessor">#endif</span>
 | 
						|
</pre>
 | 
						|
</div>
 | 
						|
<div class="section">
 | 
						|
<div class="titlepage"><div><div><h4 class="title">
 | 
						|
<a name="manual.install.building.config"></a><a class="link" href="install.html#manual.install.building.config" title="Additional configuration options"> Additional configuration
 | 
						|
        options</a>
 | 
						|
</h4></div></div></div>
 | 
						|
<p>
 | 
						|
          pugixml uses several defines to control the compilation process. There
 | 
						|
          are two ways to define them: either put the needed definitions to <code class="filename">pugiconfig.hpp</code> (it
 | 
						|
          has some examples that are commented out) or provide them via compiler
 | 
						|
          command-line. Consistency is important: the definitions should match in
 | 
						|
          all source files that include <code class="filename">pugixml.hpp</code> (including pugixml sources) throughout
 | 
						|
          the application. Adding defines to <code class="filename">pugiconfig.hpp</code> lets you guarantee this,
 | 
						|
          unless your macro definition is wrapped in preprocessor <code class="computeroutput"><span class="preprocessor">#if</span></code>/<code class="computeroutput"><span class="preprocessor">#ifdef</span></code> directive and this directive
 | 
						|
          is not consistent. <code class="filename">pugiconfig.hpp</code> will never contain anything but comments,
 | 
						|
          which means that when upgrading to a new version, you can safely leave
 | 
						|
          your modified version intact.
 | 
						|
        </p>
 | 
						|
<p>
 | 
						|
          <a name="PUGIXML_WCHAR_MODE"></a><code class="literal">PUGIXML_WCHAR_MODE</code> define toggles
 | 
						|
          between UTF-8 style interface (the in-memory text encoding is assumed to
 | 
						|
          be UTF-8, most functions use <code class="computeroutput"><span class="keyword">char</span></code>
 | 
						|
          as character type) and UTF-16/32 style interface (the in-memory text encoding
 | 
						|
          is assumed to be UTF-16/32, depending on <code class="computeroutput"><span class="keyword">wchar_t</span></code>
 | 
						|
          size, most functions use <code class="computeroutput"><span class="keyword">wchar_t</span></code>
 | 
						|
          as character type). See <a class="xref" href="dom.html#manual.dom.unicode" title="Unicode interface"> Unicode interface</a> for more details.
 | 
						|
        </p>
 | 
						|
<p>
 | 
						|
          <a name="PUGIXML_NO_XPATH"></a><code class="literal">PUGIXML_NO_XPATH</code> define disables XPath.
 | 
						|
          Both XPath interfaces and XPath implementation are excluded from compilation.
 | 
						|
          This option is provided in case you do not need XPath functionality and
 | 
						|
          need to save code space.
 | 
						|
        </p>
 | 
						|
<p>
 | 
						|
          <a name="PUGIXML_NO_STL"></a><code class="literal">PUGIXML_NO_STL</code> define disables use of
 | 
						|
          STL in pugixml. The functions that operate on STL types are no longer present
 | 
						|
          (i.e. load/save via iostream) if this macro is defined. This option is
 | 
						|
          provided in case your target platform does not have a standard-compliant
 | 
						|
          STL implementation.
 | 
						|
        </p>
 | 
						|
<p>
 | 
						|
          <a name="PUGIXML_NO_EXCEPTIONS"></a><code class="literal">PUGIXML_NO_EXCEPTIONS</code> define disables
 | 
						|
          use of exceptions in pugixml. This option is provided in case your target
 | 
						|
          platform does not have exception handling capabilities.
 | 
						|
        </p>
 | 
						|
<p>
 | 
						|
          <a name="PUGIXML_API"></a><code class="literal">PUGIXML_API</code>, <a name="PUGIXML_CLASS"></a><code class="literal">PUGIXML_CLASS</code>
 | 
						|
          and <a name="PUGIXML_FUNCTION"></a><code class="literal">PUGIXML_FUNCTION</code> defines let you
 | 
						|
          specify custom attributes (i.e. declspec or calling conventions) for pugixml
 | 
						|
          classes and non-member functions. In absence of <code class="computeroutput"><span class="identifier">PUGIXML_CLASS</span></code>
 | 
						|
          or <code class="computeroutput"><span class="identifier">PUGIXML_FUNCTION</span></code> definitions,
 | 
						|
          <code class="computeroutput"><span class="identifier">PUGIXML_API</span></code> definition
 | 
						|
          is used instead. For example, to specify fixed calling convention, you
 | 
						|
          can define <code class="computeroutput"><span class="identifier">PUGIXML_FUNCTION</span></code>
 | 
						|
          to i.e. <code class="computeroutput"><span class="identifier">__fastcall</span></code>. Another
 | 
						|
          example is DLL import/export attributes in MSVC (see <a class="xref" href="install.html#manual.install.building.shared" title="Building pugixml as a standalone shared library"> Building pugixml as
 | 
						|
        a standalone shared library</a>).
 | 
						|
        </p>
 | 
						|
<div class="note"><table border="0" summary="Note">
 | 
						|
<tr>
 | 
						|
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../images/note.png"></td>
 | 
						|
<th align="left">Note</th>
 | 
						|
</tr>
 | 
						|
<tr><td align="left" valign="top"><p>
 | 
						|
            In that example <code class="computeroutput"><span class="identifier">PUGIXML_API</span></code>
 | 
						|
            is inconsistent between several source files; this is an exception to
 | 
						|
            the consistency rule.
 | 
						|
          </p></td></tr>
 | 
						|
</table></div>
 | 
						|
<p>
 | 
						|
          <a name="PUGIXML_MEMORY_PAGE_SIZE"></a><code class="literal">PUGIXML_MEMORY_PAGE_SIZE</code>, <a name="PUGIXML_MEMORY_OUTPUT_STACK"></a><code class="literal">PUGIXML_MEMORY_OUTPUT_STACK</code>
 | 
						|
          and <a name="PUGIXML_MEMORY_XPATH_PAGE_SIZE"></a><code class="literal">PUGIXML_MEMORY_XPATH_PAGE_SIZE</code>
 | 
						|
          can be used to customize certain important sizes to optimize memory usage
 | 
						|
          for the application-specific patterns. For details see <a class="xref" href="dom.html#manual.dom.memory.tuning" title="Memory consumption tuning"> Memory consumption tuning</a>.
 | 
						|
        </p>
 | 
						|
<p>
 | 
						|
          <a name="PUGIXML_HAS_LONG_LONG"></a><code class="literal">PUGIXML_HAS_LONG_LONG</code> define enables
 | 
						|
          support for <code class="computeroutput"><span class="keyword">long</span> <span class="keyword">long</span></code>
 | 
						|
          type in pugixml. This define is automatically enabled if your platform
 | 
						|
          is known to have <code class="computeroutput"><span class="keyword">long</span> <span class="keyword">long</span></code>
 | 
						|
          support (i.e. has C++-11 support or uses a reasonably modern version of
 | 
						|
          a known compiler); if pugixml does not recognize that your platform supports
 | 
						|
          <code class="computeroutput"><span class="keyword">long</span> <span class="keyword">long</span></code>
 | 
						|
          but in fact it does, you can enable the define manually.
 | 
						|
        </p>
 | 
						|
</div>
 | 
						|
</div>
 | 
						|
<div class="section">
 | 
						|
<div class="titlepage"><div><div><h3 class="title">
 | 
						|
<a name="manual.install.portability"></a><a class="link" href="install.html#manual.install.portability" title="Portability"> Portability</a>
 | 
						|
</h3></div></div></div>
 | 
						|
<p>
 | 
						|
        pugixml is written in standard-compliant C++ with some compiler-specific
 | 
						|
        workarounds where appropriate. pugixml is compatible with the C++11 standard,
 | 
						|
        but does not require C++11 support. Each version is tested with a unit test
 | 
						|
        suite (with code coverage about 99%) on the following platforms:
 | 
						|
      </p>
 | 
						|
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
 | 
						|
<li class="listitem">
 | 
						|
            Microsoft Windows:
 | 
						|
            <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
 | 
						|
<li class="listitem">
 | 
						|
                  Borland C++ Compiler 5.82
 | 
						|
                </li>
 | 
						|
<li class="listitem">
 | 
						|
                  Digital Mars C++ Compiler 8.51
 | 
						|
                </li>
 | 
						|
<li class="listitem">
 | 
						|
                  Intel C++ Compiler 8.0, 9.0 x86/x64, 10.0 x86/x64, 11.0 x86/x64
 | 
						|
                </li>
 | 
						|
<li class="listitem">
 | 
						|
                  Metrowerks CodeWarrior 8.0
 | 
						|
                </li>
 | 
						|
<li class="listitem">
 | 
						|
                  Microsoft Visual C++ 6.0, 7.0 (2002), 7.1 (2003), 8.0 (2005) x86/x64,
 | 
						|
                  9.0 (2008) x86/x64, 10.0 (2010) x86/x64, 11.0 (2011) x86/x64/ARM,
 | 
						|
                  12.0 (2013) x86/x64/ARM and some CLR versions
 | 
						|
                </li>
 | 
						|
<li class="listitem">
 | 
						|
                  MinGW (GCC) 3.4, 4.4, 4.5, 4.6 x64
 | 
						|
                </li>
 | 
						|
</ul></div>
 | 
						|
          </li>
 | 
						|
<li class="listitem">
 | 
						|
            Linux (GCC 4.4.3 x86/x64, GCC 4.8.1 x64, Clang 3.2 x64)
 | 
						|
          </li>
 | 
						|
<li class="listitem">
 | 
						|
            FreeBSD (GCC 4.2.1 x86/x64)
 | 
						|
          </li>
 | 
						|
<li class="listitem">
 | 
						|
            Apple MacOSX (GCC 4.0.1 x86/x64/PowerPC)
 | 
						|
          </li>
 | 
						|
<li class="listitem">
 | 
						|
            Sun Solaris (sunCC x86/x64)
 | 
						|
          </li>
 | 
						|
<li class="listitem">
 | 
						|
            Microsoft Xbox 360
 | 
						|
          </li>
 | 
						|
<li class="listitem">
 | 
						|
            Nintendo Wii (Metrowerks CodeWarrior 4.1)
 | 
						|
          </li>
 | 
						|
<li class="listitem">
 | 
						|
            Sony Playstation Portable (GCC 3.4.2)
 | 
						|
          </li>
 | 
						|
<li class="listitem">
 | 
						|
            Sony Playstation 3 (GCC 4.1.1, SNC 310.1)
 | 
						|
          </li>
 | 
						|
<li class="listitem">
 | 
						|
            Various portable platforms (Android NDK, BlackBerry NDK, Samsung bada,
 | 
						|
            Windows CE)
 | 
						|
          </li>
 | 
						|
</ul></div>
 | 
						|
</div>
 | 
						|
<div class="footnotes">
 | 
						|
<br><hr style="width:100; text-align:left;margin-left: 0">
 | 
						|
<div id="ftn.trademarks" class="footnote"><p><a href="#trademarks" class="para"><sup class="para">[1] </sup></a>All trademarks used are properties of their respective
 | 
						|
          owners.</p></div>
 | 
						|
</div>
 | 
						|
</div>
 | 
						|
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 | 
						|
<td align="left"></td>
 | 
						|
<td align="right"><div class="copyright-footer">Copyright © 2014 Arseny Kapoulkine<p>
 | 
						|
        Distributed under the MIT License
 | 
						|
      </p>
 | 
						|
</div></td>
 | 
						|
</tr></table>
 | 
						|
<hr>
 | 
						|
<table width="100%"><tr>
 | 
						|
<td>
 | 
						|
<a href="http://pugixml.org/">pugixml 1.5</a> manual |
 | 
						|
		<a href="../manual.html">Overview</a> |
 | 
						|
		<b>Installation</b> |
 | 
						|
		Document:
 | 
						|
		<a href="dom.html">Object model</a> · <a href="loading.html">Loading</a> · <a href="access.html">Accessing</a> · <a href="modify.html">Modifying</a> · <a href="saving.html">Saving</a> |
 | 
						|
		<a href="xpath.html">XPath</a> |
 | 
						|
		<a href="apiref.html">API Reference</a> |
 | 
						|
		<a href="toc.html">Table of Contents</a>
 | 
						|
</td>
 | 
						|
<td width="*" align="right"><div class="spirit-nav">
 | 
						|
<a accesskey="p" href="../manual.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../manual.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../manual.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="dom.html"><img src="../images/next.png" alt="Next"></a>
 | 
						|
</div></td>
 | 
						|
</tr></table>
 | 
						|
</body>
 | 
						|
</html>
 |