<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>コンパイル アーカイブ - 自動売買を作ろう！</title>
	<atom:link href="https://mql-programing.com/archives/tag/%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB/feed/" rel="self" type="application/rss+xml" />
	<link>https://mql-programing.com/archives/tag/コンパイル/</link>
	<description>MQLプログラミング学習サイト</description>
	<lastBuildDate>Tue, 31 Mar 2026 13:02:13 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://mql-programing.com/main29/wp-content/uploads/2021/02/cropped-ブログアイコン-32x32.jpg</url>
	<title>コンパイル アーカイブ - 自動売買を作ろう！</title>
	<link>https://mql-programing.com/archives/tag/コンパイル/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>【MQL4定数】コンパイルに使用する定数​（__○○__）</title>
		<link>https://mql-programing.com/archives/2708/compile_constant/</link>
		
		<dc:creator><![CDATA[朝日奈りさ]]></dc:creator>
		<pubDate>Thu, 05 May 2022 04:45:19 +0000</pubDate>
				<category><![CDATA[【辞書】MQLリファレンス]]></category>
		<category><![CDATA[定数]]></category>
		<category><![CDATA[MQL]]></category>
		<category><![CDATA[リファレンス]]></category>
		<category><![CDATA[コンパイル]]></category>
		<guid isPermaLink="false">https://mql-programing.com/?p=2708</guid>

					<description><![CDATA[<p>コンパイルに使用する定数​（__○○__） コンパイルに使用する定数は、コンパイルするときに使用します。 そのため、プログラムに記述することはほとんど無い定数です。 しかし、プログラムをデバッグするときに、とても便利な定 [&#8230;]</p>
<p>投稿 <a href="https://mql-programing.com/archives/2708/compile_constant/">【MQL4定数】コンパイルに使用する定数​（__○○__）</a> は <a href="https://mql-programing.com">自動売買を作ろう！</a> に最初に表示されました。</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading"><span id="toc1">コンパイルに使用する定数​（__○○__）</span></h2>



<p>コンパイルに使用する定数は、コンパイルするときに使用します。</p>



<p><strong>そのため、プログラムに記述することはほとんど無い定数です。</strong></p>



<p>しかし、プログラムをデバッグするときに、とても便利な定数なので、プログラムを書くかたは、知っておくと良いでしょう。</p>



<p>ちなみにアンダーバーは、前後に2つずつです。</p>



<p>　</p>



<p><span class="marker-under-red"><strong>コンパイルに使用する定数を使用する関数は、特にありません。</strong></span></p>



<p>定数単体として使うだけで、情報を参照することができます。</p>



<p>　</p>



<h3 class="wp-block-heading"><span id="toc2">コンパイルに使用する定数（__○○__）</span></h3>



<figure class="wp-block-table alignfull is-style-stripes"><table><tbody><tr><td><strong>定数</strong></td><td><strong>説明</strong></td></tr><tr><td>__DATE__</td><td>コンパイル時の日付</td></tr><tr><td>__DATETIME__</td><td>コンパイル時の日時</td></tr><tr><td>__LINE__</td><td>定数が記述されたプログラムの行数</td></tr><tr><td>__FILE__</td><td>コンパイルしたファイル名</td></tr><tr><td>__PATH__</td><td>コンパイルしたファイルへの絶対パス</td></tr><tr><td>__FUNCTION__</td><td>定数が記述された関数名</td></tr><tr><td>__FUNCSIG__</td><td>定数が記述された関数のシグネチャ</td></tr><tr><td>__MQLBUILD__</td><td>コンパイラのビルド番号</td></tr><tr><td>__MQL4BUILD__</td><td>コンパイラのビルド番号</td></tr></tbody></table></figure>



<p>　</p>



<h2 class="wp-block-heading"><span id="toc3">コンパイルに使用する定数​（__○○__）の使い方</span></h2>



<p>定数をプログラムに記述するだけで、その定数に対応した情報を取得することができます。</p>



<p>例えば、以下のように使用します。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-cpp" data-lang="C++"><code>void OnInit() {
   Print(" 関数名= ",__FUNCTION__,"  ソースコード行数 = ",__LINE__); // ソースコードの7行目
}</code></pre></div>



<p>　</p>



<p>上記のように記述すると、以下のように表示されます。</p>



<p>「出力結果：関数名= OnInit ソースコード行数 = 7」</p>



<p>　</p>



<h2 class="wp-block-heading"><span id="toc4">サンプルプログラム</span></h2>



<p>以下は、コンパイルに使用する定数をすべて出力するサンプルプログラムです。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-cpp" data-lang="C++"><code>//+------------------------------------------------------------------+
//| コンパイルに使用する定数 サンプルプログラム                        |
//+------------------------------------------------------------------+
void OnInit()
{
   // コンパイル時の日付
   Print("__DATE__      = ", __DATE__);

   // コンパイル時の日時
   Print("__DATETIME__  = ", __DATETIME__);

   // 定数が記述されたプログラムの行数
   Print("__LINE__      = ", __LINE__);

   // コンパイルしたファイル名
   Print("__FILE__      = ", __FILE__);

   // コンパイルしたファイルへの絶対パス
   Print("__PATH__      = ", __PATH__);

   // 定数が記述された関数名
   Print("__FUNCTION__  = ", __FUNCTION__);

   // 定数が記述された関数のシグネチャ
   Print("__FUNCSIG__   = ", __FUNCSIG__);

   // コンパイラのビルド番号
   Print("__MQLBUILD__  = ", __MQLBUILD__);

   // コンパイラのビルド番号（MQL4用）
   Print("__MQL4BUILD__ = ", __MQL4BUILD__);
}
//+------------------------------------------------------------------+</code></pre></div>



<p>　</p>



<p>上記のプログラムを実行すると、ターミナルのエキスパートタブに以下のような情報が出力されます。</p>



<p>各定数がどのような値を返すのか、実際に確認してみてください。</p>



<p>　</p>



<div class="wp-block-cocoon-blocks-button-1 button-block"><a href="https://mql-programing.com/sample_program/" class="btn btn-l btn-circle" target="_self">サンプルプログラムはこちら</a></div>



<p>　</p>



<figure class="wp-block-embed is-type-wp-embed is-provider-自動売買を作ろう！ wp-block-embed-自動売買を作ろう！"><div class="wp-block-embed__wrapper">

<a href="https://mql-programing.com/make_autotrade_by_myself/" title="【MQL4プログラミング】自動売買の作り方！FXで使えるテンプレートあり" class="blogcard-wrap external-blogcard-wrap a-wrap cf" target="_blank"><div class="blogcard external-blogcard eb-left cf"><div class="blogcard-label external-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail external-blogcard-thumbnail"><img decoding="async" src="https://i0.wp.com/mql-programing.com/main29/wp-content/uploads/2021/09/make_autotrade_by_myself.jpg?fit=1200%2C675&#038;ssl=1" alt="" class="blogcard-thumb-image external-blogcard-thumb-image" width="160" height="90" /></figure><div class="blogcard-content external-blogcard-content"><div class="blogcard-title external-blogcard-title">【MQL4プログラミング】自動売買の作り方！FXで使えるテンプレートあり</div><div class="blogcard-snippet external-blogcard-snippet">目次 はじめにFX自動売買とはFX自動売買を作るための準備FX自動売買の作り方口座凍結の対策をするプログラムテンプレートを作る決済ロジックをプログラミングするプログラムテンプレートを作るエントリーロジックをプログラミング</div></div><div class="blogcard-footer external-blogcard-footer cf"><div class="blogcard-site external-blogcard-site"><div class="blogcard-favicon external-blogcard-favicon"><img decoding="async" src="https://www.google.com/s2/favicons?domain=https://mql-programing.com/archives/1605/make_autotrade_by_myself/" alt="" class="blogcard-favicon-image external-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain external-blogcard-domain">mql-programing.com</div></div></div></div></a>
</div></figure>



<figure class="wp-block-embed is-type-wp-embed is-provider-自動売買を作ろう！ wp-block-embed-自動売買を作ろう！"><div class="wp-block-embed__wrapper">

<a href="https://mql-programing.com/mql-reference/" title="MQL4リファレンス【全データ一覧】" class="blogcard-wrap internal-blogcard-wrap a-wrap cf"><div class="blogcard internal-blogcard ib-left cf"><div class="blogcard-label internal-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail internal-blogcard-thumbnail"><img decoding="async" width="160" height="90" src="https://mql-programing.com/main29/wp-content/uploads/2021/02/MQLリファレンス-160x90.jpg" class="blogcard-thumb-image internal-blogcard-thumb-image wp-post-image" alt="" srcset="https://mql-programing.com/main29/wp-content/uploads/2021/02/MQLリファレンス-160x90.jpg 160w, https://mql-programing.com/main29/wp-content/uploads/2021/02/MQLリファレンス-300x169.jpg 300w, https://mql-programing.com/main29/wp-content/uploads/2021/02/MQLリファレンス-1024x576.jpg 1024w, https://mql-programing.com/main29/wp-content/uploads/2021/02/MQLリファレンス-768x432.jpg 768w, https://mql-programing.com/main29/wp-content/uploads/2021/02/MQLリファレンス-120x68.jpg 120w, https://mql-programing.com/main29/wp-content/uploads/2021/02/MQLリファレンス-320x180.jpg 320w, https://mql-programing.com/main29/wp-content/uploads/2021/02/MQLリファレンス.jpg 1120w" sizes="(max-width: 160px) 100vw, 160px" /></figure><div class="blogcard-content internal-blogcard-content"><div class="blogcard-title internal-blogcard-title">MQL4リファレンス【全データ一覧】</div><div class="blogcard-snippet internal-blogcard-snippet">/*! elementor - v3.6.5 - 27-04-2022 */.e-container.e-container--row .elementor-spacer-inner{width:var(--spacer-size)}.e-</div></div><div class="blogcard-footer internal-blogcard-footer cf"><div class="blogcard-site internal-blogcard-site"><div class="blogcard-favicon internal-blogcard-favicon"><img loading="lazy" decoding="async" src="https://www.google.com/s2/favicons?domain=https://mql-programing.com" alt="" class="blogcard-favicon-image internal-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain internal-blogcard-domain">mql-programing.com</div></div></div></div></a>
</div></figure>



<p>　</p>
<p>投稿 <a href="https://mql-programing.com/archives/2708/compile_constant/">【MQL4定数】コンパイルに使用する定数​（__○○__）</a> は <a href="https://mql-programing.com">自動売買を作ろう！</a> に最初に表示されました。</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
