Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Solved] Undefined Reference `__atomic_fetch_add_4'  (Read 5972 times)

0 Members and 1 Guest are viewing this topic.

MintyBreath

  • Newbie
  • *
  • Posts: 2
    • View Profile
[Solved] Undefined Reference `__atomic_fetch_add_4'
« on: November 26, 2013, 11:47:09 pm »
Hey everyone! I've been trying to get SFML 2.1 to work with MinGW and Code::Blocks and can't seem to figure out this compilation error.

Quote
-------------- Build: Debug in SFML2.1 ---------------

Linking console executable: bin\Debug\SFML2.1.exe
obj\Debug\main.o: In function `_exchange_and_add':
c:/mingw/lib/gcc/mingw32/4.8.1/include/c++/ext/atomicity.h:47: undefined reference to `__atomic_fetch_add_4'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings

I've been following the official tutorial (http://www.sfml-dev.org/tutorials/2.1/start-cb.php), and haven't noticed any obvious mistakes. The code I'm using is exactly copied from the tutorial, so no need to paste that here.

I tried hitting google and haven't been able to find much help. Anyway, has anyone encountered this problem? Any suggestions on what I should search in order to fix this issue? I'm not entirely sure what's causing the problem between MinGW, SFML, and Code::blocks.

Thanks in advance for the help!  :)

Edit: And I should probably clarify that I have no problem compiling normally with MinGW. I just have the issue with SFML. The version of SFML I downloaded is for GCC MinGW DW2. I've tried a few other versions, and compiling the source from scratch and keep getting the same error. At the moment I'm linking SFML statically.


EDIT 2: UUUUUUUGH I've been working on this issue for 2 days, and the SECOND I post for help online I figure out the issue. So for SOME reason Code::blocks had i386 option ticked in the project build options. I tried unticking that, and sure enough it worked fine. Anyway, just ignore this thread.
« Last Edit: November 27, 2013, 12:14:38 am by MintyBreath »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10822
    • View Profile
    • development blog
    • Email
Re: Undefined Reference `__atomic_fetch_add_4'
« Reply #1 on: November 27, 2013, 12:13:36 am »
The linker has issue resolving a symbol within your MinGW setup, not sure why SFML triggers it, but it seems like your MinGW install is corrupted, you might want to reinstall it. Where did you get the MinGW from?

Also keep in mind that SFML currently doesn't provide binaries for newer compilers, so for a MinGW version with GCC 4.8.1 there aren't any pre-compiled binaries, thus you have to recompile SFML on your own.
« Last Edit: November 27, 2013, 12:23:26 am by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MintyBreath

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: [Solved] Undefined Reference `__atomic_fetch_add_4'
« Reply #2 on: November 27, 2013, 12:18:50 am »
Thanks eXpl0it3r, that's very helpful. Sure enough, immediately after posting I figured the problem out myself.  :-[

Anyway, thanks for your time!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10822
    • View Profile
    • development blog
    • Email
Re: [Solved] Undefined Reference `__atomic_fetch_add_4'
« Reply #3 on: November 27, 2013, 12:27:40 am »
No problem - might have learned something new myself, if a similar issue comes up again in the future. ;)

Btw. don't hesitate to ask sooner if you're really stuck on an issue. It's good when you try to solve things on your own, so you get the best learning effect, but we can often also give you some ideas to poke, so you might find the cause sooner. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything