I originally asked a question regarding issues I am having getting the #include header file to function correctly. C++ multithreading errors . Specifically, I get the error that "'thread' was not declared in this scope". I am beginning to wonder if my original assumption that I was installing the mingw.thread.h header file incorrectly (located here: https://github.com/meganz/mingw-std-threads ). This seemingly helps solve these issues for many people,
Can someone provide a description of how to install this file correctly?
These are the results when I run gcc -v on my terminal:
Using built-in specs.
COLLECT_GCC=c:\MinGW\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/6.3.0/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-6.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --target=mingw32 --with-gmp=/mingw --with-mpfr --with-mpc=/mingw --with-isl=/mingw --prefix=/mingw --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-6.3.0-1' --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --enable-libgomp --disable-libvtv --enable-nls
Thread model: win32
gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)
edit: To help, when I include the "mingw.thread.h" and compile, I get these errors:
error: #error To use the MinGW-std-threads library, you will need to define the macro _WIN32_WINNT to be 0x0501 (Windows XP) or higher.
#error To use the MinGW-std-threads library, you will need to define the macro _WIN32_WINNT to be 0x0501 (Windows XP) or higher.
To use this header follow the instructions .
mingw.thread.h
header and save it somewhere on your include path.#include <thread>
to #include "mingw.thread.h"
in your code_WIN32_WINNT
correctly. The easiest way to do this is via the gcc command line, eg add -D_WIN32_WINNT=0x0501
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.