MacOS – compile error: is not implemented

gccmacosxcode

When I compile a open source program called gate with "make" I have this error message:

error <atomic> is not implemented

I must add that I know this program and I compiled it several times previously with no problem

My setup looks like:

sudo xcode-select --install 
which gcc
gcc --version

I run on yosemite 10.10.5, xcode 7.1.1 and I tried several compilations with clang and gcc

Best Answer

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:

  1. 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.
  2. Remove Xcode and remove all the compilers you have downloaded and installed.
  3. 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

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

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

#include<atomic>
#include<iostream>

using namespace std;

int main()
{
    cout << "Hello World" << 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: <atomic> is not implemented
#error <atomic> 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;

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