core/com.nokia.carbide.cpp.doc.user/html/concepts/precompiled_headers.htm
author fturovic <frank.turovich@nokia.com>
Fri, 16 Apr 2010 09:51:37 -0500
branchRCL_2_4
changeset 1225 a546534a48de
parent 939 47d3ca29d054
permissions -rw-r--r--
minor edits to remote conn pages, updated copyrights, fixed some broken links
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
939
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     2
<html>
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     3
<head>
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     4
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     5
<meta http-equiv="Content-Style-Type" content="text/css" />
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     6
<meta name="LASTUPDATED" content="06/17/05 11:09:43" />
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     7
<title>Precompiled Headers </title>
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     8
<link rel="StyleSheet" href="../../book.css" type="text/css"/>
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     9
</head>
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    10
<body bgcolor="#FFFFFF">
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    11
<h2>Precompiled Headers </h2>
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    12
<p>Precompiled header support is available for Symbian OS projects that use the Nokia x86
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    13
compiler. Precompiled header files use the <span class="code">.pch++ </span>extension and are only supported by emulator targets. </p>
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    14
<p>By default, the x86 compiler compiles the <span class="code">.pch++</span> file before compiling any <span class="code">.cpp</span> files in a project. </p>
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    15
<p>A precompiled header file (<span class="code">.pch++</span>) outputs to a new identically named file with the <span class="code">.mch</span> extension. For example, <span class="code">HelloWorld.pch++</span> outputs as <span class="code">HelloWorld.mch</span>. C++ source files must use the <span class="code">.pch++</span> extension.</p>
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    16
<p>Listing 1 shows an example of a precompiled header source file called
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    17
<span class="code">pch_test.pch++</span>.</p>
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    18
<div class="listing">
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    19
  <h4>Listing 1 .pch Precompiled Header example</h4>
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    20
  <p class="listing">#include &lt;e32def.h&gt;<br />
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    21
  #pragma precompile_target &quot;pch_test.mch&quot;<br />
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    22
  <br />
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    23
  #define FOO 1<br />
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    24
  #define LATIDA 345</p>
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    25
  <p class="listing">typedef struct foo<br />
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    26
    {<br />
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    27
&nbsp;&nbsp;&nbsp;&nbsp;int i, j, k, l, m;<br />
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    28
&nbsp;&nbsp;&nbsp;&nbsp;char foobar[256];<br />
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    29
} foo;</p>
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    30
</div>
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    31
<p>The resultant output file, <span class="code">pch_test.mch</span> can be included in other source or prefix files as:</p>
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    32
<p class="listing"> #include pch_test.mch</p>
1225
a546534a48de minor edits to remote conn pages, updated copyrights, fixed some broken links
fturovic <frank.turovich@nokia.com>
parents: 939
diff changeset
    33
<div id="footer">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. <br>License: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a></div>
939
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    34
47d3ca29d054 revision of concept section of manual pages and images
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    35
</body>
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    36
</html>