Compiler error: Mingw WinXP (undefined reference to `__sync_add_and_fetch_4')


#1

I'm tryign to build 'Introjucer' in Windows XP with Mingw 4.4.1 (in CodeBlocks) and am getting 7 errors like this.

 

undefined reference to `__sync_add_and_fetch_4'

This is happening on lines in the source code with this entry:


 return sizeof (Type) == 4 ? castFrom32Bit ((int32) __sync_add_and_fetch ((volatile int32*) &value, 0))
                              : castFrom64Bit ((int64) __sync_add_and_fetch ((volatile int64*) &value, 0)); //ERROR HAPPENS HERE

I can only assume there is a need for a compiler flag for this but I'm not sure what?  

Would anyone know how to fix this as I really want to use JUCE.    Thanks


#2

Since your comment hasn't been replied to, Google seems to be your friend: https://www.google.ca/search?q=__sync_add_and_fetch&oq=__sync_add_and_fetch&aqs=chrome..69i57&sourceid=chrome&ie=UTF-8#q=__sync_add_and_fetch+undefined


#3

I've solved this now.  Compiler / Introducer version mismatch. 

Basically, new code compiled by an older version of Mingw compiler will cause this. 

 

Google is the first place I looked though it took allot of wading (as expected) to find that out.