0

When trying to build a simple test program that uses atomic operations, I get the error undefined reference to `___atomic_fetch_sub_4'
Specifically, it only happens when I do a -- combined with ==:

std::atomic&ltstd::size_t> foo;
if (--foo == 42) { ... }

The code compiles fine, but I get the error while trying to link. I'm using MinGW with GCC 4.7.

Mark
  • 2,082
  • 3
  • 17
  • 30
  • According to [this bug ticket](http://sourceforge.net/tracker/?func=detail&atid=102435&aid=3420359&group_id=2435), MinGW for x86 does not yet support atomics. – ildjarn Jun 30 '12 at 00:51

1 Answers1

0

std::thread and std::atomic still have very limited support with MinGW. If you want to experiment with those C++11 features on windows, I recommend Visual Studio 2012 RC.

Jesse Good
  • 50,901
  • 14
  • 124
  • 166
  • The problem is Visual Studio 2012RC still doesn't have the variadic templates I need – Mark Jun 30 '12 at 01:35
  • Well, the only option then would be to use [MinGW-w64](http://mingw-w64.sourceforge.net/) which has support for atomics (however, I cannot guarantee that you won't run into any problems). Also, `std::thread` and `std::regex` are still lacking. – Jesse Good Jun 30 '12 at 01:38