compile error:  is not implemented
Looking at the question, the edits and the comments, it's becoming clear that the setup of your compiler chain and the headers is probably the cause. You could keep trying to add things, but I would take a different tack:


Make a full backup of the Mac - one that you are serious about using if you wipe the machine and run a test compile of the program and then restore either the full backup or files you need selectively from the backup.
Remove Xcode and remove all the compilers you have downloaded and installed.
Install a tool to assist with the maintenance and installation of the compiler and the need header library files for the latest c++ standard.


The tool I use is homebrew, so you can install it per https://brew.sh


brew update
brew doctor - and be sure you follow any of the advice in the doctor or post here for advice
brew install gcc


Here is the test program I used for a "minimal test case"

#include&lt;atomic&gt;
#include&lt;iostream&gt;

using namespace std;

int main()
{
    cout &lt;&lt; "Hello World" &lt;&lt; endl;
}


Before using the "brew" version of gcc, I get what I presume is the same error as you:

mac:Desktop me$ /usr/bin/gcc gate\ test.cpp
In file included from gate test.cpp:1:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/atomic:543:2: error: &lt;atomic&gt; is not implemented
#error &lt;atomic&gt; is not implemented
 ^
1 error generated.
mac:Desktop me$ which gcc
/usr/bin/gcc


But if I compile it using the "brew installed gcc", I'm getting a very nice detailed message

mac:Desktop me$ g++-5 gate\ test.cpp 
In file included from /usr/local/Cellar/gcc/5.2.0/include/c++/5.2.0/atomic:38:0,
                 from gate test.cpp:1:
/usr/local/Cellar/gcc/5.2.0/include/c++/5.2.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
mac:Desktop me$ g++-5 gate\ test.cpp -std=c++11


TLDR; 


pointing your compiler to g++5
delete other compilers as needed (including Xcode possibly)
adding the compile option -std=c++11