2022-09-07 02:15 AM
Hello,
I am getting this compilation error when running simulator:
error: 'mutex' in namespace 'std' does not name a type
From the informations I had found about this topic, this error is caused by used thread model of MINGW32. MINGW32, which comes together with TouchGFX is configured to WIN32, but just POSIX thread model support std concurrency library.
GCC -V says:
$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\TouchGFX\4.20.0\env\MinGW\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/TouchGFX/4.20.0/env/MinGW/bin/../libexec/gcc/i686-w64-mingw32/7.3.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../../../src/gcc-7.3.0/configure --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/c/mingw730/i686-730-win32-dwarf-rt_v5-rev0/mingw32 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --enable-libstdcxx-filesystem-ts=yes --disable-sjlj-exceptions --with-dwarf2 --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tune=generic --with-libiconv --with-system-zlib --with-gmp=/c/mingw730/prerequisites/i686-w64-mingw32-static --with-mpfr=/c/mingw730/prerequisites/i686-w64-mingw32-static --with-mpc=/c/mingw730/prerequisites/i686-w64-mingw32-static --with-isl=/c/mingw730/prerequisites/i686-w64-mingw32-static --with-pkgversion='i686-win32-dwarf-rev0, Built by MinGW-W64 project' --with-bugurl=sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw730/i686-730-win32-dwarf-rt_v5-rev0/mingw32/opt/include -I/c/mingw730/prerequisites/i686-zlib-static/include -I/c/mingw730/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw730/i686-730-win32-dwarf-rt_v5-rev0/mingw32/opt/include -I/c/mingw730/prerequisites/i686-zlib-static/include -I/c/mingw730/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw730/i686-730-win32-dwarf-rt_v5-rev0/mingw32/opt/include -I/c/mingw730/prerequisites/i686-zlib-static/include -I/c/mingw730/prerequisites/i686-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw730/i686-730-win32-dwarf-rt_v5-rev0/mingw32/opt/lib -L/c/mingw730/prerequisites/i686-zlib-static/lib -L/c/mingw730/prerequisites/i686-w64-mingw32-static/lib -Wl,--large-address-aware'
Thread model: win32
gcc version 7.3.0 (i686-win32-dwarf-rev0, Built by MinGW-W64 project)
I have tried some workarounds and tips which I had found, but without change (e.g add -std=c++0x option to user_cflags in app.mk, install mingw32-pthreads-w32 package etc.)
So my questions are:
P.S. : I am not very familiar with GCC, MINGW32, etc. So I am sorry if there is some misunderstanding from my side.
Related references (as a new user I cannot add links directly :/):
stackoverflow.com/questions/43658560/i-installed-mingw32-pthreads-w32-but-i-still-cannot-compile-stdmutex
stackoverflow.com/questions/14191566/c-mutex-in-namespace-std-does-not-name-a-type?answertab=trending#tab-top
stackoverflow.com/questions/13134186/c11-stdthreads-vs-posix-threads
stackoverflow.com/questions/37358856/does-mingw-w64-support-stdthread-out-of-the-box-when-using-the-win32-threading
stackoverflow.com/questions/14191566/c-mutex-in-namespace-std-does-not-name-a-type