Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error : BOOST DISABLE THREADS

Tags:

c++

boost

freebsd

i have some problem with my boost library. i m using freebsd and installed my boost using ports. Boost version is : 1.45 and i use g++47 as compiler. Also i have never defined BOOST DISABLE THREADS at there : /usr/local/include/boost/config/user.hpp .Also exactly my error is :

 /usr/local/include/boost/config/requires_threads.hpp:29:4: error: #error "Threading    support unavaliable: it has been explicitly disabled with BOOST_DISABLE_THREADS"  

explicitly but where ?? And my compile command;

 g++47 -O3 -Wall -std=c++0x   -I. -Iinclude -I../include -I/usr/local/include   -c -o     Application.o src/Application.cpp 

Thanks

like image 989
iyasar Avatar asked Nov 28 '11 14:11

iyasar


People also ask

How do I stop a thread boost?

Interrupting a Thread A running thread can be interrupted by calling the interrupt() member function on the corresponding boost::thread object. If the thread doesn't have a boost::thread object (e.g the initial thread of the application), then it cannot be interrupted.

Does boost use Pthread?

Since boost is mainly just a wrapper around pthreads (on posix platforms) it helps to know what is going on underneath. In attempting to be generic, boost leaves the platform specific functionality unwrapped. In order to get to it you need to use the native_handle() calls.


2 Answers

The experimental GCC version 4.7 disables Boost.Threads. See: https://svn.boost.org/trac/boost/ticket/6165

Edit: It should be noted that as of the release version of GCC 4.7, and Boost higher than 1.48 (Boost_1_48_0 is still not working), threads works again.

like image 127
Some programmer dude Avatar answered Oct 07 '22 22:10

Some programmer dude


See the ticket 6165 mentioned above by Joachim:
To define 'threads' support,

  • GCC <= 4.6 defines _GLIBCXX__PTHREADS
  • whereas GCC >= 4.7 defines _GLIBCXX_HAS_GTHREADS.
So, in order to compile older Boosts using any GCC more recent than 4.6 you need the patch libstdcpp3.hpp.patch enclosed in that ticket.

Another problem that could also prevent Boost on working with modern compiler is ticket 6940 (TIME_UTC has a special meanhing in C11, therefore Boost >= 1.50 use TIME_UTC_ instead)

like image 23
DrYak Avatar answered Oct 07 '22 22:10

DrYak