Linker error: undefined reference to the symbol 'pthread_rwlock_trywrlock @@ GLIBC_2.2.5'

I developed with CentOS, Qt 4.7 and GCC 4.4

I just installed Red Hat Developer Toolset 1.1, which includes GCC 4.7.2, and in the end makeI get an error

/usr/bin/ld: ../../bin/Solo: undefined reference to symbol 'pthread_rwlock_trywrlock@@GLIBC_2.2.5'
/usr/bin/ld: note: 'pthread_rwlock_trywrlock@@GLIBC_2.2.5' is defined in DSO /lib64/libpthread.so.0 so try adding it to the linker command line
/lib64/libpthread.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

I assume Qt threads are referencing this. How can i fix this?

+5
source share
4 answers

You want to compile with -pthread, which does more than just a link with libpthread:

Adds multithreading support using the pthreads library. This option sets flags for both the preprocessor and the linker.

+14
source

: /lib64/libpthread.so.0 Makefile (-lpthread gcc /lib64/libpthread.so.0 ld ( gcc -shared)) - LIB += -lpthread, -.

. : Qt Creator http://www.qtcentre.org/threads/39144-How-to-add-a-lib-to-a-qt-project

Btw, Makefile, - .

+4

CONFIG += thread .pro .

+3

Linux ( )

LDFLAGS=-lpthread

END configure.

make ( ).

0
source

All Articles