When I compiled a simple C++ code in mobaxterm, I got this error.
+g++ test.cpp-otest
File included from /usr/lib/gcc/i686-pc-cygwin/7.3.0/include/c++/i686-pc-cygwin/bits/gthr.h: 148:0 ,
from/usr/lib/gcc/i686-pc-cygwin/7.3.0/include/c++/ext/atomicity.h:35,
from/usr/lib/gcc/i686-pc-cygwin/7.3.0/include/c++/bits/ios_base.h:39,
from/usr/lib/gcc/i686-pc-cygwin/7.3.0/include/c++/ios:42,
from/usr/lib/gcc/i686-pc-cygwin/7.3.0/include/c++/ostream:38,
from/usr/lib/gcc/i686-pc-cygwin/7.3.0/include/c++/iostream:39,
from test.cpp:1:
/usr/lib/gcc/i686-pc-cygwin/7.3.0/include/c++/i686-pc-cygwin/bits/gthr-default.h: Function 'int_gthread_mutex_timedlock(_pthread_mutex_t**, const_gthread_time_t*)':
/usr/lib/gcc/i686-pc-cygwin/7.3.0/include/c++/i686-pc-cygwin/bits/gthr-default.h:768:12: Error: 'pthread_mutex_timedlock' was not decoded in this scope
return__gthrw_(pthread_mutex_timedlock)(_mutex,_abs_timeout);
^
/usr/lib/gcc/i686-pc-cygwin/7.3.0/include/c++/i686-pc-cygwin/bits/gthr-default.h:768:12:Note: Suggested alternative: '__gthread_mutex_timedlock'
I don't know the cause, so please let me know if anyone knows the solution to this error.
The source code is as follows:
#include<iostream>
using namespace std;
int main()
{
cout<<"a";
return 0;
}
Thank you.
Here are the results of the g++-Q-v:
gg++-Q-v
I'm using built-in spec.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-cygwin/7.3.0/lto-wrapper.exe
Target: i686-pc-cygwin
configure 設定: /cygdrive/i/szsz/tmpp/gcc/gcc-7.3.0-3.i686/src/gcc-7.3.0/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-7.3.0-3.i686/src/gcc-7.3.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=i686-pc-cygwin --host=i686-pc-cygwin --target=i686-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-arch=i686 --with-tune=generic --disable-sjlj-exceptions --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libcilkrts --enable-libgomp --enable-libitm --enable-libquadmath --enable-libquadmath-support --disable-libssp --enable-libada --disable-symvers --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible --enable-libstdcxx-filesystem-ts
Thread Model: posix
gcc version 7.3.0 (GCC)
I'm a beginner and I don't know if there's a way to do it, but I got this kind of error when I tried it.(See below)
gg++--disable-threads test.cpp-otest
cc1plus:errors:unknown pass threads specified in-fdisable
Currently, by reinstalling the latest version of MobaXterm, the gcc version has changed and can be compiled and executed successfully.
When I tried to update gcc with apt on MobaXterm with the corresponding error in the question, it was already up to date (gcc-7.3.0), so I couldn't update it.
© 2024 OneMinuteCode. All rights reserved.