core/com.nokia.carbide.cpp.compiler.doc.user/html/performance/perf_precompiled_using.htm
author fturovic <frank.turovich@nokia.com>
Mon, 19 Jul 2010 16:13:24 -0500
changeset 1641 2b3996fc09a1
parent 0 fb279309251b
permissions -rw-r--r--
revised x86 compiler dates, graphics, CSS, and release notes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1641
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"><html>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     2
<head>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     3
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     4
<meta http-equiv="Content-Style-Type" content="text/css" />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     5
<meta name="LASTUPDATED" content="06/17/05 11:09:43" />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     6
<title>Using a Precompiled Header File</title>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     7
<link rel="StyleSheet" href="../../book.css" type="text/css"/>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     8
</head>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
     9
<body bgcolor="#FFFFFF">
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    10
<h3>Using a Precompiled Header File</h3>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    11
<p>Although a precompiled file is not a text file, you use it like you would a regular header file. To include a precompiled header file in a source code file, use the <span class="code">#include</span> directive.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    12
<p class="note"><strong>NOTE</strong> Unlike regular header files in text format, a source code file may include only one precompiled file.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    13
<p class="note"><strong>TIP</strong> Instead of explicitly including a precompiled file in each source code file with the<span class="code"> #include</span> directive, put the precompiled file name in the Prefix File field of the C/C++ Language settings panel. If the Prefix File field already specifies a file name, include the precompiled file in the prefix file with the <span class="code">#include</span> directive.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    14
<p>Listing 5.1 and Listing 5.2 show an example.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    15
<div class="listing">
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    16
  <h5>Listing 5.1 Header File that Creates a Precompiled Header File for C</h5>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    17
  <p>// sock_header.pch<br />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    18
    // When compiled or precompiled, this file will generate a <br />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    19
    // precompiled file named &quot;sock_precomp.mch&quot;</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    20
  <p>#pragma precompile_target &quot;sock_precomp.mch&quot;</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    21
  <p>#define SOCK_VERSION &quot;SockSorter 2.0&quot;<br />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    22
    #include &quot;sock_std.h&quot;<br />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    23
    #include &quot;sock_string.h&quot;<br />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    24
    #include &quot;sock_sorter.h&quot;</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    25
</div>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    26
<div class="listing">
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    27
  <h5>Listing 5.2 Using a Precompiled File</h5>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    28
  <p>// sock_main.c<br />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    29
    // Instead of including all the files included in <br />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    30
    // sock_header.pch, we use sock_precomp.h instead.<br />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    31
    //<br />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    32
    // A precompiled file must be included before anything else.</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    33
  <p>#include &quot;sock_precomp.mch&quot;</p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    34
  <p>int main(void)<br />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    35
    {<br />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    36
    // ...<br />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    37
    return 0;<br />
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    38
    }
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    39
  </p>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    40
</div>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    41
<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>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    42
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    43
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    44
</body>
2b3996fc09a1 revised x86 compiler dates, graphics, CSS, and release notes
fturovic <frank.turovich@nokia.com>
parents: 0
diff changeset
    45
</html>