c++ compiles in Ubuntu but not in centOS
<p>I have a bunch of code which compiles in Ubuntu using GCC 4.8.4.
When I transfer to centOS and compile it there the following errors occur:</p>

<pre><code>[  0%] Building CXX object src/chrono/CMakeFiles/ChronoEngine.dir/core/ChClassRegister.cpp.o
In file included from /home/com/medyn/chrono/chrono_ver1/Chrono_source_Old/src/chrono/core/ChClassRegister.cpp:21:
/home/com/medyn/chrono/chrono_ver1/Chrono_source_Old/src/chrono/core/ChClassRegister.h: In destructor 'chrono::ChClassFactory::~ChClassFactory()':
/home/com/medyn/chrono/chrono_ver1/Chrono_source_Old/src/chrono/core/ChClassRegister.h:225: error: expected initializer before ':' token
/home/com/medyn/chrono/chrono_ver1/Chrono_source_Old/src/chrono/core/ChClassRegister.h:228: error: could not convert '((chrono::ChLog*)chrono::GetLog())-&gt;chrono::ChLog::&lt;anonymous&gt;.chrono::ChStreamOutAscii::operator&lt;&lt;(((const char*)"Delete ChClassFactory \012"))' to 'bool'
/home/com/medyn/chrono/chrono_ver1/Chrono_source_Old/src/chrono/core/ChClassRegister.h:229: error: expected primary-expression before '}' token
/home/com/medyn/chrono/chrono_ver1/Chrono_source_Old/src/chrono/core/ChClassRegister.h:229: error: expected ')' before '}' token
/home/com/medyn/chrono/chrono_ver1/Chrono_source_Old/src/chrono/core/ChClassRegister.h:229: error: expected primary-expression before '}' token
/home/com/medyn/chrono/chrono_ver1/Chrono_source_Old/src/chrono/core/ChClassRegister.h:229: error: expected ';' before '}' token
make[2]: *** [src/chrono/CMakeFiles/ChronoEngine.dir/core/ChClassRegister.cpp.o] Error 1
make[1]: *** [src/chrono/CMakeFiles/ChronoEngine.dir/all] Error 2
make: *** [all] Error 2
</code></pre>

<p>These errors are for both GCC 4.4.7 and GCC 4.8.5.
The lines of code for which it gives the error are:</p>

<pre><code>    ~ChClassFactory () {
    for(const auto &amp; it : class_map ) {
       GetLog() &lt;&lt; "   registered: " &lt;&lt; it.first &lt;&lt; "\n";
    }
    GetLog() &lt;&lt; "Delete ChClassFactory \n";
    }
</code></pre>

<p>And the files included at the top of this script are:</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;string&gt;
#include &lt;typeinfo&gt;
#include "core/ChLog.h"
#include "core/ChRunTimeType.h"
#include &lt;unordered_map&gt;
</code></pre>

<p>I have checked that all of the include files exists and I have made another script to test if I can use them, and I can. </p>

<p>The reason why I don't stay with Ubuntu is because the Supercomputer I have to use is running centOS.</p>

<p>Does anyone have a solution for this problem?</p>

<p>Please let my know if you need additional information.</p>

<p>Regards, 
Anders</p>

<h3>Edit</h3>

<p>With the GCC 4.8.5 version the program provided by NathanOliver compiles and run.
I compile it directly from terminal using:</p>

<pre><code>g++ -std=c++11 main.cpp -o main
./main
1 2 3 4 5 
</code></pre>

<p>And it runs with <code>-std=c++0x</code>.
Somehow I cant use <code>-std=c++14</code>.
It gives the following error:</p>

<pre><code>g++: error: unrecognized command line option '-std=c++14'
</code></pre>

<h3>Edit</h3>

<p>So to get back to the main problem. My Makefile I have, have the following line:</p>

<pre><code>//Flags used by the compiler during all build types.
CMAKE_CXX_FLAGS:STRING=-std=c++0x
</code></pre>

<p>So I can't see why the program should not run?</p>