Reputation: 1516
Greetings,
I've recently moved out of my unix shelter to test a supposedly cross-platform networking library only to discover that mingw doesn't like to be fed c++11 stuff.
I presume that I'm missing the required headers since Win7 doesn't come packed with c++11 support.
It compiles just fine with VS2012
but g++ refuses to.
error: 'thread' in namespace 'std' does not name a type error: 'mutex' in namespace 'std' does not name a type
The question is:
How do I get a copy of c++11 headers/libs i.e. < thread > without using the ones provided by VS2012 installation.
P.S. #1 I tried mingw-get update but it still wont find < thread >
P.S. #2 I am also using -std=c++11
Sincerely,
Chris.
Upvotes: 24
Views: 16119
Reputation: 16
Go to: https://sourceforge.net/projects/mingw-w64/files/?source=navbar.
Find and download.
MinGW-W64 GCC-8.1.0:
x86_64-posix-seh
Unzip and move to MinGW folder.
If you are compiling with g++:
Create bash alias to the new g++ bin path ('/mingw/x86_64-8.1.0-release-posix-seh-rt_v6-rev0/mingw64/bin/g++')
Compile using new g++ bin.
If you are using Cmake:
Create CmakeLists.txt and add: set(CMAKE_CXX_COMPILER /mingw/x86_64-8.1.0-release-posix-seh-rt_v6-rev0/mingw64/bin/g++)
Compile using Cmake/make
Upvotes: 0
Reputation: 1439
Look also here: https://github.com/meganz/mingw-std-threads This is a lighter, native implementation of std::thread and others, without using the win32 port of pthreads.
Upvotes: 6
Reputation: 1516
These MinGW-w64 builds support C++11 threads,atomic operations etc.
Note that MinGW-w64 is not 64-bit only, but does support it, unlike the old MinGW(.org) which is missing quite a lot of the new Vista+ APIs, and of course 64-bit support.
Upvotes: 16