Question

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<std::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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top