undefined reference to a static constant variable collect2: ld returned 1 exit status
<p>Please help me </p>

<p>Error details as follows:</p>

<blockquote>
  <p>src/a.cpp:2972: undefined reference to `B::XTT collect2: ld returned 1 exit status</p>
</blockquote>

<p><code>B::XTT</code> is a static constant variable in the <code>B</code> struct.</p>

<pre><code>2969     if (index != B::XTT) {
2970         index_map_iter = lookup_index.find(merchandising_index);
2971         merchandising_index = index_map_iter != output_index.end() ? \
2972                index_map_iter-&gt;second : B::XTT;
</code></pre>

<p>It is very strange that the first time I use <code>B::XTT</code> on line 2969, it does not produce an error. But at 2972 I use <code>B::XTT</code>, and it produces an error.</p>

<p>And if I add <code>-O2</code> option when I use <code>g++</code> command, it does not produce an error.
But it does produce an error without <code>-O2</code>.</p>
