<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://twiki.yo-net.jp/index.php?action=history&amp;feed=atom&amp;title=Cpp_%E3%83%97%E3%83%AA%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB%E6%B8%88%E3%83%98%E3%83%83%E3%83%80%E3%83%BC%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB</id>
	<title>Cpp プリコンパイル済ヘッダーファイル - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://twiki.yo-net.jp/index.php?action=history&amp;feed=atom&amp;title=Cpp_%E3%83%97%E3%83%AA%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB%E6%B8%88%E3%83%98%E3%83%83%E3%83%80%E3%83%BC%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB"/>
	<link rel="alternate" type="text/html" href="https://twiki.yo-net.jp/index.php?title=Cpp_%E3%83%97%E3%83%AA%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB%E6%B8%88%E3%83%98%E3%83%83%E3%83%80%E3%83%BC%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB&amp;action=history"/>
	<updated>2026-04-05T02:43:08Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.38.2</generator>
	<entry>
		<id>https://twiki.yo-net.jp/index.php?title=Cpp_%E3%83%97%E3%83%AA%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB%E6%B8%88%E3%83%98%E3%83%83%E3%83%80%E3%83%BC%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB&amp;diff=5794&amp;oldid=prev</id>
		<title>Yo-net: /* プリコンパイル済ヘッダーファイル */</title>
		<link rel="alternate" type="text/html" href="https://twiki.yo-net.jp/index.php?title=Cpp_%E3%83%97%E3%83%AA%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB%E6%B8%88%E3%83%98%E3%83%83%E3%83%80%E3%83%BC%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB&amp;diff=5794&amp;oldid=prev"/>
		<updated>2024-01-14T20:14:44Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;プリコンパイル済ヘッダーファイル&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2024年1月15日 (月) 05:14時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l13&quot;&gt;13行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;13行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;　プログラムは複数のファイルに分けて書くことができます。特にクラスを多用するC++では、ヘッダファイル部(関数の定義だけ)とプログラム部(定義された関数の実際の処理内容)とのペアが沢山出来上がります。大きなプロジェクトほどファイル数は膨大になり、50ファイル～500ファイル、あるいは5000ファイルとかもあり得ます。このメディアWikiのようなDBに記事内容を登録して、各ページごとにテキストを処理してHTMLとしての表示をするというプログラムでも3500ファイルほどで構成されています。PHPという言語ですが…もっと複雑な処理を必要とするwindowsのようなGUIアプリケーションなら、販売向けプログラム製品では膨大なファイル数になることは容易に想像がつきます。ですが、毎回、全部のファイルをコンパイルしていたら、もの凄くコンパイル時間がかかって、1回のコンパイル・リンク処理で15分～1時間くらいかかって、デバッグとかで繰り返し、試しに動かして見るということが、コンパイルの待ち時間にいくらでも耐えれて、集中力があって、時間が無尽蔵にあって、開発スピードは求めていない人でないとやりきれないです。個人でもウィンドウズアプリケーションを作る場合にはWindows.ｈファイルのような巨大なヘッダファイルを読み込むので、数十秒くらい時間がかかっていることを体感できると思います。いくつものファイルから呼ばれるヘッダファイルは、呼び出しをしているファイルが更新される都度、呼び出されたものの、まったく変更されていないにも関わらず、コンパイルしなおそうとします。この無駄なコンパイルを少し減らそうというのが、プリコンパイル済ヘッダーファイルの役目です。但し、何度も変更するファイルがプリコンパイルの対象に含まれるとプリコンパイルファイルを作成する機会が多くなり効果が目減りします。なのでプリコンパイルの対象は、&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;　プログラムは複数のファイルに分けて書くことができます。特にクラスを多用するC++では、ヘッダファイル部(関数の定義だけ)とプログラム部(定義された関数の実際の処理内容)とのペアが沢山出来上がります。大きなプロジェクトほどファイル数は膨大になり、50ファイル～500ファイル、あるいは5000ファイルとかもあり得ます。このメディアWikiのようなDBに記事内容を登録して、各ページごとにテキストを処理してHTMLとしての表示をするというプログラムでも3500ファイルほどで構成されています。PHPという言語ですが…もっと複雑な処理を必要とするwindowsのようなGUIアプリケーションなら、販売向けプログラム製品では膨大なファイル数になることは容易に想像がつきます。ですが、毎回、全部のファイルをコンパイルしていたら、もの凄くコンパイル時間がかかって、1回のコンパイル・リンク処理で15分～1時間くらいかかって、デバッグとかで繰り返し、試しに動かして見るということが、コンパイルの待ち時間にいくらでも耐えれて、集中力があって、時間が無尽蔵にあって、開発スピードは求めていない人でないとやりきれないです。個人でもウィンドウズアプリケーションを作る場合にはWindows.ｈファイルのような巨大なヘッダファイルを読み込むので、数十秒くらい時間がかかっていることを体感できると思います。いくつものファイルから呼ばれるヘッダファイルは、呼び出しをしているファイルが更新される都度、呼び出されたものの、まったく変更されていないにも関わらず、コンパイルしなおそうとします。この無駄なコンパイルを少し減らそうというのが、プリコンパイル済ヘッダーファイルの役目です。但し、何度も変更するファイルがプリコンパイルの対象に含まれるとプリコンパイルファイルを作成する機会が多くなり効果が目減りします。なのでプリコンパイルの対象は、&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;＃あらゆるファイルからよく呼び出される。&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#あらゆるファイルからよく呼び出される。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;＃あまり変更する必要がなくなった。&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#あまり変更する必要がなくなった。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;＃規模が大きい。&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#規模が大きい。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;そのようなファイルだけを一度プリコンパイル済ファイルを作っておくということをします。そういった作業をするために１つのヘッダファイルに、プリコンパイルしたいヘッダファイル群を呼び出すように作成して、プリコンパイル済みヘッダーファイルのオブジェクト(.pch)を作成します。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;そのようなファイルだけを一度プリコンパイル済ファイルを作っておくということをします。そういった作業をするために１つのヘッダファイルに、プリコンパイルしたいヘッダファイル群を呼び出すように作成して、プリコンパイル済みヘッダーファイルのオブジェクト(.pch)を作成します。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Yo-net</name></author>
	</entry>
	<entry>
		<id>https://twiki.yo-net.jp/index.php?title=Cpp_%E3%83%97%E3%83%AA%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB%E6%B8%88%E3%83%98%E3%83%83%E3%83%80%E3%83%BC%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB&amp;diff=5793&amp;oldid=prev</id>
		<title>Yo-net: /* プリコンパイル済ヘッダーファイル */</title>
		<link rel="alternate" type="text/html" href="https://twiki.yo-net.jp/index.php?title=Cpp_%E3%83%97%E3%83%AA%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB%E6%B8%88%E3%83%98%E3%83%83%E3%83%80%E3%83%BC%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB&amp;diff=5793&amp;oldid=prev"/>
		<updated>2024-01-14T20:13:58Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;プリコンパイル済ヘッダーファイル&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2024年1月15日 (月) 05:13時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l11&quot;&gt;11行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;11行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== '''プリコンパイル済ヘッダーファイル''' ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== '''プリコンパイル済ヘッダーファイル''' ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;　プログラムは複数のファイルに分けて書くことができます。特にクラスを多用するC++では、ヘッダファイル部(関数の定義だけ)とプログラム部(定義された関数の実際の処理内容)とのペアが沢山出来上がります。大きなプロジェクトほどファイル数は膨大になり、50ファイル～500ファイル、あるいは5000ファイルとかもあり得ます。このメディアWikiのようなDBに記事内容を登録して、各ページごとにテキストを処理してHTMLとしての表示をするというプログラムでも3500ファイルほどで構成されています。PHPという言語ですが…もっと複雑な処理を必要とするwindowsのようなGUIアプリケーションなら、販売向けプログラム製品では膨大なファイル数になることは容易に想像がつきます。ですが、毎回、全部のファイルをコンパイルしていたら、もの凄くコンパイル時間がかかって、1回のコンパイル・リンク処理で15分～1時間くらいかかって、デバッグとかで繰り返し、試しに動かして見るということが、コンパイルの待ち時間にいくらでも耐えれて、集中力があって、時間が無尽蔵にあって、開発スピードは求めていない人でないとやりきれないです。個人でもウィンドウズアプリケーションを作る場合にはWindows.&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ｈファイルのような巨大なヘッダファイルを読み込むので、数十秒くらい時間がかかっていることを体感できると思います。いくつものファイルから呼ばれるヘッダファイルは、呼び出しをしているファイルが更新される都度、呼び出されたものの、まったく変更されていないにも関わらず、コンパイルしなおそうとします。この無駄なコンパイルを少し減らそうというのが、プリコンパイル済ヘッダーファイルの役目です。但し、何度も変更するファイルがプリコンパイルの対象に含まれるとプリコンパイルファイルを作成する機会が多くなり効果が目減りします。なのでプリコンパイルの対象は、＃あらゆるファイルからよく呼び出される、＃あまり変更する必要がなくなった、＃規模が大きい。そのようなファイルだけを一度プリコンパイル済ファイルを作っておくということをします。そういった作業をするために１つのヘッダファイルに、プリコンパイルしたいヘッダファイル群を呼び出すように作成して、プリコンパイル済みヘッダーファイルのオブジェクト&lt;/del&gt;(.pch)を作成します。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;　プログラムは複数のファイルに分けて書くことができます。特にクラスを多用するC++では、ヘッダファイル部(関数の定義だけ)とプログラム部(定義された関数の実際の処理内容)とのペアが沢山出来上がります。大きなプロジェクトほどファイル数は膨大になり、50ファイル～500ファイル、あるいは5000ファイルとかもあり得ます。このメディアWikiのようなDBに記事内容を登録して、各ページごとにテキストを処理してHTMLとしての表示をするというプログラムでも3500ファイルほどで構成されています。PHPという言語ですが…もっと複雑な処理を必要とするwindowsのようなGUIアプリケーションなら、販売向けプログラム製品では膨大なファイル数になることは容易に想像がつきます。ですが、毎回、全部のファイルをコンパイルしていたら、もの凄くコンパイル時間がかかって、1回のコンパイル・リンク処理で15分～1時間くらいかかって、デバッグとかで繰り返し、試しに動かして見るということが、コンパイルの待ち時間にいくらでも耐えれて、集中力があって、時間が無尽蔵にあって、開発スピードは求めていない人でないとやりきれないです。個人でもウィンドウズアプリケーションを作る場合にはWindows.&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ｈファイルのような巨大なヘッダファイルを読み込むので、数十秒くらい時間がかかっていることを体感できると思います。いくつものファイルから呼ばれるヘッダファイルは、呼び出しをしているファイルが更新される都度、呼び出されたものの、まったく変更されていないにも関わらず、コンパイルしなおそうとします。この無駄なコンパイルを少し減らそうというのが、プリコンパイル済ヘッダーファイルの役目です。但し、何度も変更するファイルがプリコンパイルの対象に含まれるとプリコンパイルファイルを作成する機会が多くなり効果が目減りします。なのでプリコンパイルの対象は、&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;＃あらゆるファイルからよく呼び出される。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;＃あまり変更する必要がなくなった。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;＃規模が大きい。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;そのようなファイルだけを一度プリコンパイル済ファイルを作っておくということをします。そういった作業をするために１つのヘッダファイルに、プリコンパイルしたいヘッダファイル群を呼び出すように作成して、プリコンパイル済みヘッダーファイルのオブジェクト&lt;/ins&gt;(.pch)を作成します。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Yo-net</name></author>
	</entry>
	<entry>
		<id>https://twiki.yo-net.jp/index.php?title=Cpp_%E3%83%97%E3%83%AA%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB%E6%B8%88%E3%83%98%E3%83%83%E3%83%80%E3%83%BC%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB&amp;diff=86&amp;oldid=prev</id>
		<title>Yo-net: ページの作成:「C++に戻る   &lt;table class=&quot;mbox-small&quot; style=&quot;border:1px solid #aaa; background-color:#f9f9f9; width:22em;&quot; id=&quot;RealTitleBanner&quot;&gt; &lt;tr&gt; &lt;td style=&quot;width:1px;&quot;&gt;&lt;/td&gt; &lt;td class=&quot;mbox-text plainlist&quot; style=&quot;&quot;&gt;本来の表記は「&lt;b&gt;&lt;span id=&quot;RealTitle&quot; style=&quot;font-size:large;&quot;&gt;C++(Cpp) プリコンパイル済ヘッダーファイル&lt;/span&gt;&lt;/b&gt;」です。この記事に付けられた題名は{{記事名の制約}}から不正確な…」</title>
		<link rel="alternate" type="text/html" href="https://twiki.yo-net.jp/index.php?title=Cpp_%E3%83%97%E3%83%AA%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB%E6%B8%88%E3%83%98%E3%83%83%E3%83%80%E3%83%BC%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB&amp;diff=86&amp;oldid=prev"/>
		<updated>2022-09-26T01:57:06Z</updated>

		<summary type="html">&lt;p&gt;ページの作成:「&lt;a href=&quot;/C_PlusPlus#C++からの技術&quot; title=&quot;C PlusPlus&quot;&gt;C++&lt;/a&gt;に戻る   &amp;lt;table class=&amp;quot;mbox-small&amp;quot; style=&amp;quot;border:1px solid #aaa; background-color:#f9f9f9; width:22em;&amp;quot; id=&amp;quot;RealTitleBanner&amp;quot;&amp;gt; &amp;lt;tr&amp;gt; &amp;lt;td style=&amp;quot;width:1px;&amp;quot;&amp;gt;&amp;lt;/td&amp;gt; &amp;lt;td class=&amp;quot;mbox-text plainlist&amp;quot; style=&amp;quot;&amp;quot;&amp;gt;本来の表記は「&amp;lt;b&amp;gt;&amp;lt;span id=&amp;quot;RealTitle&amp;quot; style=&amp;quot;font-size:large;&amp;quot;&amp;gt;C++(Cpp) プリコンパイル済ヘッダーファイル&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt;」です。この記事に付けられた題名は{{記事名の制約}}から不正確な…」&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[C PlusPlus#C++からの技術|C++]]に戻る&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table class=&amp;quot;mbox-small&amp;quot; style=&amp;quot;border:1px solid #aaa; background-color:#f9f9f9; width:22em;&amp;quot; id=&amp;quot;RealTitleBanner&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;width:1px;&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td class=&amp;quot;mbox-text plainlist&amp;quot; style=&amp;quot;&amp;quot;&amp;gt;本来の表記は「&amp;lt;b&amp;gt;&amp;lt;span id=&amp;quot;RealTitle&amp;quot; style=&amp;quot;font-size:large;&amp;quot;&amp;gt;C++(Cpp) プリコンパイル済ヘッダーファイル&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt;」です。この記事に付けられた題名は{{記事名の制約}}から不正確なものとなっています。&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
※このページでは[[C PlusPlus|C++]]にのみ存在する機能として、記事タイトルが&amp;lt;nowiki&amp;gt;C++ プリコンパイル済ヘッダーファイル&amp;lt;/nowiki&amp;gt;になっています。&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
== '''プリコンパイル済ヘッダーファイル''' ==&lt;br /&gt;
　プログラムは複数のファイルに分けて書くことができます。特にクラスを多用するC++では、ヘッダファイル部(関数の定義だけ)とプログラム部(定義された関数の実際の処理内容)とのペアが沢山出来上がります。大きなプロジェクトほどファイル数は膨大になり、50ファイル～500ファイル、あるいは5000ファイルとかもあり得ます。このメディアWikiのようなDBに記事内容を登録して、各ページごとにテキストを処理してHTMLとしての表示をするというプログラムでも3500ファイルほどで構成されています。PHPという言語ですが…もっと複雑な処理を必要とするwindowsのようなGUIアプリケーションなら、販売向けプログラム製品では膨大なファイル数になることは容易に想像がつきます。ですが、毎回、全部のファイルをコンパイルしていたら、もの凄くコンパイル時間がかかって、1回のコンパイル・リンク処理で15分～1時間くらいかかって、デバッグとかで繰り返し、試しに動かして見るということが、コンパイルの待ち時間にいくらでも耐えれて、集中力があって、時間が無尽蔵にあって、開発スピードは求めていない人でないとやりきれないです。個人でもウィンドウズアプリケーションを作る場合にはWindows.ｈファイルのような巨大なヘッダファイルを読み込むので、数十秒くらい時間がかかっていることを体感できると思います。いくつものファイルから呼ばれるヘッダファイルは、呼び出しをしているファイルが更新される都度、呼び出されたものの、まったく変更されていないにも関わらず、コンパイルしなおそうとします。この無駄なコンパイルを少し減らそうというのが、プリコンパイル済ヘッダーファイルの役目です。但し、何度も変更するファイルがプリコンパイルの対象に含まれるとプリコンパイルファイルを作成する機会が多くなり効果が目減りします。なのでプリコンパイルの対象は、＃あらゆるファイルからよく呼び出される、＃あまり変更する必要がなくなった、＃規模が大きい。そのようなファイルだけを一度プリコンパイル済ファイルを作っておくということをします。そういった作業をするために１つのヘッダファイルに、プリコンパイルしたいヘッダファイル群を呼び出すように作成して、プリコンパイル済みヘッダーファイルのオブジェクト(.pch)を作成します。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
　少し前のVisualStudio2017あたりまでは新規プロジェクト作成をするウィザードでプログラミングを始めようとするとstdafx.hファイルが生成され、その中によく使うヘッダファイルであるstdio.hやwindows.hを呼び出していました。VisualStudio2019になるとpch.h(おそらくPre Compile Headerという意味の)ファイルが出来るだけで、その中のファイルは自分で作るという感じになりました。&lt;br /&gt;
&lt;br /&gt;
=== '''使い方''' ===&lt;br /&gt;
&lt;br /&gt;
　VisualStdio2019では、ウィザード形式を使わないプロジェクトテンプレートが多く、自分でpch.hファイルにあたるものを作るところから始まります。メニューの{プロジェクト}&amp;amp;gt;{新しい項目の追加}を選択して表示されるダイアログでファイルの種類にヘッダファイルを選択して、ファイル名欄にpch.hというような名前のヘッダファイルを作ります。もう一つ、ダミーとして、そのプログラムファイルを作ります。メニューの{プロジェクト}&amp;amp;gt;{新しい項目の追加}を選択して表示されるダイアログでファイルの種類にC++ファイルを選択してファイル名欄にpch.cppとしてファイルを作ります。pch.hに先ほどのべたようなプリコンパイルファイルにするべきヘッダをインクルードするように作り込みます。コンソールプログラムなら#incude &amp;lt;cstdio&amp;gt;をpch.hに入れてます。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
　次に&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
　プロジェクトの設定を変更するので、メニューの{プロジェクト}&amp;amp;gt;{プロパティ}を選択して表示されるダイアログで、左側のツリーから{C/C++}&amp;amp;gt;{プリコンパイル済ヘッダ}を選択して、項目：プリコンパイル済ヘッダ＝使用(/Yu)、項目：プリコンパイル済ヘッダファイル＝pch.h、項目：プリコンパイル済ヘッダ出力ファイル：$(IntDir)$(TargetName).pch、のように設定します。そして、プリコンパイルヘッダファイルを作成するべきpch.cppとpch.hの組み合わせに対して作成のための設定が必要なので、ダイアログを閉じないまま、ファイル一覧が閲覧できるソリューションエクスプローラからpch.cppを選択して、左側のツリーから{C/C++}&amp;amp;gt;{プリコンパイル済ヘッダ}の、項目：プリコンパイル済ヘッダ＝作成(/Yc)、と設定します。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
　既に、コンパイルしたことのあるプロジェクトは、リビルドを実施した方が良いと思いますが、この状態であれば、プリコンパイル済ヘッダーファイルを活用することが出来ます。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
　小さなプロジェクトであれば、この他の選択肢として、プリコンパイル済ヘッダーの機能を使わない設定と全部で作成(/Yc)する設定が使えるものだと思います。プリコンパイル済機能を使わない設定では、毎回、変更された全ファイルと変更されたファイルから呼び出している共通のヘッダファイル部とそのプログラムの分も含めてコンパイルすることになります。プロジェクト全体で全てのヘッダーファイルがプリコンパイル済ヘッダーファイルを作成すると毎回プリコンパイルファイルを作り直して生成するようになります。単純にひと手間増えるだけです。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
　pch.hファイルはプリコンパイルファイルの対象でありますが、各ファイルのpch.hが呼び出される前の部分もプリコンパイルの対象になります。pch.cppに対して作成(/Yc)と設定したので、pch.cppが変更されたら、プリコンパイル済ヘッダーファイルが作成されます。pch.cppから#include &amp;quot;pch.h&amp;quot;のようなインクルード文は必要です。pchファイルが更新されたら、プリコンパイル済ヘッダーファイルを作成するということを決めるだけのファイルです。pch.hの内容やpch.hから呼び出しているプログラムに変更があるか、pch.cppに変更があれば、プリコンパイル済みのヘッダーファイルは再作成されます。他のcppファイルで作成(/Yc)を設定してもプリコンパイル済ファイルの作成の機能が働きますが、よく更新されるcppにそれを設定したら、無駄にプリコンパイル済ファイルが生成される回数も増えるので、何も更新するよていのない、プロジェクトに読み込んだpch.cppに作成(/Yc)のオプションを定義した感じです。pchという名前ではなく、今までのstdafx.hという名前でプリコンパイル対象のヘッダーファイルを纏めてもいいです。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
　出力ファイル：$(IntDir)$(TargetName).pchと設定したのですが、これはプロジェクト名を同じ名前でプリコンパイル済ヘッダーファイルのオブジェクトを作成するということを意味しています。xxxx.pchという、これまでに述べた通常の使い方においては、わりかし大きめのファイルがビルドあるいはリビルドをしたときに出来上がるはずです。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
　&lt;br /&gt;
&lt;br /&gt;
　&lt;/div&gt;</summary>
		<author><name>Yo-net</name></author>
	</entry>
</feed>