Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
84 user(s) are online (50 user(s) are browsing Forums)

Members: 1
Guests: 83

Tohe, more...

Support us!

Headlines

 
  Register To Post  

GCC 11, atomic_bool and linker errors [SOLVED by -latomic]
Just can't stay away
Just can't stay away


See User information
I'm trying to compile something like:

// gcc atomic.cpp -Wall -athread=native -std=c++20

#include <atomic>

int main()
{
    
std::atomic_bool ab false;

    
ab true;
    
ab.notify_one();

    
ab.wait(false);

    return 
0;
}


But it gives linker errors. Issue seems to be functionality added in C++20 (wait and notify_one). Wondering if this is some known issue and should I report it somewhere.


Edited by Capehill on 2025/12/4 20:31:41
Go to top
Re: GCC 11, atomic_bool and linker errors
Just can't stay away
Just can't stay away


See User information
It compiles if you use

ppc-amigaos-g++ -o atomic atomic.cpp -std=c++20 -athread=native -latomic

or

ppc-amigaos-gcc -o atomic atomic.cpp -std=c++20 -athread=native -latomic -lstdc++

Go to top
Re: GCC 11, atomic_bool and linker errors
Just can't stay away
Just can't stay away


See User information
@MickJT

Thanks, works! For some reason -latomic was not required on Linux (gcc13). Maybe there are implementation differences.

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project