64,678
社区成员
发帖
与我相关
我的任务
分享
#include <thread>
void f(){}
void g(){}
int main()
{
std::thread t1( f );
std::thread t2( g );
t1.join();
t2.join();
return 0;
}
Run one of the following command lines:
make clean GC (to build the GNU C dll with C cleanup code)
make clean GCE (to build the GNU C dll with C++ exception handling)
make clean GC-inlined (to build the GNU C inlined dll with C cleanup code)
make clean GCE-inlined (to build the GNU C inlined dll with C++ exception hand
ling)
make clean GC-static (to build the GNU C inlined static lib with C cleanup c
ode)
make clean GC-debug (to build the GNU C debug dll with C cleanup code)
make clean GCE-debug (to build the GNU C debug dll with C++ exception handli
ng)
make clean GC-inlined-debug (to build the GNU C inlined debug dll with C clea
nup code)
make clean GCE-inlined-debug (to build the GNU C inlined debug dll with C++ ex
ception handling)
make clean GC-static-debug (to build the GNU C inlined static debug lib with
C cleanup code)
Using built-in specs.
Target: i686-mingw32
Configured with: ../../src/gcc-4.4.5/configure --prefix=/mingw --host=i686-mingw
32 --target=i686-mingw32 --build=i686-pc-linux-gnu --enable-languages=c,c++ --en
able-static --enable-cxx-flags='-fno-function-sections -fno-data-sections' --ena
ble-fully-dynamic-string --enable-version-specific-runtime-libs --enable-threads
=win32 --enable-libgomp --enable-libiconv --disable-shared --disable-nls --disab
le-werror --disable-libstdcxx-pch --disable-win32-registry --disable-sjlj-except
ions --with-dwarf2 --with-gmp=/home/loaden/AUR/mingw32/depends --with-mpfr=/home
/loaden/AUR/mingw32/depends --with-pkgversion='QP MinGW32' --with-bugurl=http://
qp-gcc.googlecode.com
Thread model: win32
gcc version 4.4.5 (QP MinGW32)
$ make clean GC-inlined
$ cp libpthreadGC2.a /mingw/lib/libpthread.a
$ cp pthread.h sched.h semaphore.h /mingw/include/
$ cp pthread.h pthreadGC2.dll /mingw/bin/
$ make clean GC-static
$ cp libpthreadGC2.a /mingw/lib/libpthread.a
$ cp pthread.h sched.h semaphore.h /mingw/include/
http://code.google.com/p/pcxprj/wiki/GCC45xBuildbyPcX
cvs -d :pserver:anoncvs@sourceware.org:/cvs/pthreads-win32 login
{enter ``anoncvs'' for the password}
cvs -d :pserver:anoncvs@sourceware.org:/cvs/pthreads-win32 checkout pthreads
ftp://sourceware.org/pub/pthreads-win32/
c:\workspace>g++ thread_test.cc -std=c++0x -g -o tt -lpthread -static
C:\Users\feng\AppData\Local\Temp\ccFpiDZe.o: In function `_gthread_equal':
c:/downloads/mingw_win32_gcc4.5.3static_snapshots/bin/../lib/gcc/i686-pc-mingw32
/4.5.3/include/c++/i686-pc-mingw32/bits/gthr-posix.h:701: undefined reference to
`_imp__pthread_equal'
c:/downloads/mingw_win32_gcc4.5.3static_snapshots/bin/../lib/gcc/i686-pc-mingw32
/4.5.3\libstdc++.a(thread.o):thread.cc:(.text+0x2d): undefined reference to `_im
p__pthread_create'
c:/downloads/mingw_win32_gcc4.5.3static_snapshots/bin/../lib/gcc/i686-pc-mingw32
/4.5.3\libstdc++.a(thread.o):thread.cc:(.text+0x50): undefined reference to `_im
p__pthread_join'
c:/downloads/mingw_win32_gcc4.5.3static_snapshots/bin/../lib/gcc/i686-pc-mingw32
/4.5.3\libstdc++.a(thread.o):thread.cc:(.text+0x6c): undefined reference to `_im
p__pthread_detach'
c:/downloads/mingw_win32_gcc4.5.3static_snapshots/bin/../lib/gcc/i686-pc-mingw32
/4.5.3\libstdc++.a(thread.o):thread.cc:(.text+0x96): undefined reference to `_im
p__pthread_equal'
collect2: ld returned 1 exit status