How to enable experimental C++11 concurrency features in MinGW?

前端 未结 8 1989
夕颜
夕颜 2020-11-30 06:46

When trying to compile the following code

#include 
#include 

void foo() { std::cout << \"foo\\n\"; }

int main()
{
  st         


        
8条回答
  •  情歌与酒
    2020-11-30 07:30

    I am currently working on getting a GCC steamed up that uses the new mingw-w64 winpthreads library. This would enable a posix threading model in GCC, and work is underway to get it working like it should. Another mingw-w64 user has already got this functioning by hacking around (sensibly), but I'm trying to get it done in mainline GCC, without manual intervention after toolchain installation.

    The present discussion can be followed here. I will update this answer once all rough edges have been smoothed out.

    EDIT: Due to an upvote, this answer came to my attention. I have built an experimental GCC 4.7, which should work with std::thread, but only when linking statically (add -static to the link command). The announcement is here.

提交回复
热议问题