473,289 Members | 2,091 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

Ask for help. Boost Thread Problem with VS 2005

#include <boost/thread/thread.hpp>
#include <iostream>

using namespace std;
using namespace boost;

void hello()
{
cout << "Hello world, I'm a thread!" << endl;
}

int main(int argc, char* argv[])
{
thread thrd(&hello);
thrd.join();

return 0;
}

===================

The above code cannot be compiled in VS 2005. The compiler reports an
error message "Threading support unavaliable: it has been explicitly
disabled with BOOST_DISABLE_THREADS", What's the cause?

Who know the solution to it? Thanks in advance. Any help is appreciated.

Jul 13 '06 #1
4 2462
The above code cannot be compiled in VS 2005. The compiler reports an
error message "Threading support unavaliable: it has been explicitly
disabled with BOOST_DISABLE_THREADS", What's the cause?
I don't have an answer to your question, I'm sorry. I'm a UNIX geek,
so VS 2005 is something I don't pay any attention to. :(

However, you'll probably have better luck if you ask on a Microsoft or
Visual Studio-specific newsgroup. comp.lang.c++ is meant for questions
about the C++ ISO standard, not questions about specific compilers.

Good luck getting things fixed!

Jul 13 '06 #2
Lighter wrote:
#include <boost/thread/thread.hpp>
#include <iostream>

using namespace std;
using namespace boost;

void hello()
{
cout << "Hello world, I'm a thread!" << endl;
}

int main(int argc, char* argv[])
{
thread thrd(&hello);
thrd.join();

return 0;
}

===================

The above code cannot be compiled in VS 2005. The compiler reports an
error message "Threading support unavaliable: it has been explicitly
disabled with BOOST_DISABLE_THREADS", What's the cause?
Have you defined BOOST_DISABLE_THREADS in boost\config\user.hpp ?

-
SJ

Jul 13 '06 #3

Lighter wrote:
#include <boost/thread/thread.hpp>
#include <iostream>

using namespace std;
using namespace boost;

void hello()
{
cout << "Hello world, I'm a thread!" << endl;
}

int main(int argc, char* argv[])
{
thread thrd(&hello);
thrd.join();

return 0;
}

===================

The above code cannot be compiled in VS 2005. The compiler reports an
error message "Threading support unavaliable: it has been explicitly
disabled with BOOST_DISABLE_THREADS", What's the cause?

Who know the solution to it? Thanks in advance. Any help is appreciated.
Just read the boost thread documentation, particularly on
configuration:

http://boost.org/doc/html/thread/con...implementation

According to the documentation, a VS project must include the
multithreaded version of the runtime in order to use boost threads.
Furthermore, the #include directives should be:

#include <boost/config.hpp>
#include <boost/thread.hpp>

Greg

Jul 13 '06 #4
Greg wrote:
Lighter wrote:
#include <boost/thread/thread.hpp>
#include <iostream>

using namespace std;
using namespace boost;

void hello()
{
cout << "Hello world, I'm a thread!" << endl;
}

int main(int argc, char* argv[])
{
thread thrd(&hello);
thrd.join();

return 0;
}

===================

The above code cannot be compiled in VS 2005. The compiler reports an
error message "Threading support unavaliable: it has been explicitly
disabled with BOOST_DISABLE_THREADS", What's the cause?

Who know the solution to it? Thanks in advance. Any help is appreciated.

Just read the boost thread documentation, particularly on
configuration:

http://boost.org/doc/html/thread/con...implementation

According to the documentation, a VS project must include the
multithreaded version of the runtime in order to use boost threads.
Right. That's the OP's problem.
Furthermore, the #include directives should be:

#include <boost/config.hpp>
#include <boost/thread.hpp>
You don't need to manually include <boost/config.hpp>, and the
top-level <boost/thread.hpppulls in all the parts of the thread
library, which the OP may not want or need. There's no problem
including just <boost/thread/thread.hpp>, as the author of the library
does in his examples, found here:

http://www.ddj.com/showArticle.jhtml...leID=184401518

Cheers! --M

Jul 13 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: linyanhung | last post by:
I used a boost multi thread in VS 2005 on a Duo Core PC, and made a two thread process. The code is something like this: #include <boost/thread/thread.hpp> void fun1() { //do something
4
by: Gary Wessle | last post by:
Hi given the Boost thread example here http://www-eleves-isia.cma.fr/documentation/BoostDoc/boost_1_29_0/libs/thread/example/thread.cpp the code below attempts to run the example thread while...
1
by: Chris Roth | last post by:
I've been working with boost::threads to do some multithreading in my code and have run into some questions that I haven't been able to find answers to. I'll include some sample code to...
3
by: =?iso-8859-1?B?Tm9yZGz2dw==?= | last post by:
Hey there, C++ Coders! I am learning multi-threading with boost and have come up with the following code example shown below. This example implements a test of the producer-consumer design...
30
by: Alf P. Steinbach | last post by:
I once suggested in that SomeOne Else(TM) should propose a string value class that accepted literals and char pointers and so on, with possible custom deleter, and in case of literal strings just...
6
by: hsmit.home | last post by:
Hello, I came across a strange error and it's really been bugging me. Maybe someone else has come across this and any insight would be appreciated. What I'm trying to accomplish is using...
2
by: Chameleon | last post by:
Why this strange output? Why so many d'tor calls? The code: ---------------------------------------------------------- #include <cstdio> #include <boost/thread/thread.hpp> class A {
3
by: Lars Uffmann | last post by:
I have this wxWidgets OnButtonClick event handler, that apparently holds a lock on all widgets in my form, but this event handler is supposed to end a thread in the background - while that thread...
19
by: =?ISO-8859-1?Q?Nordl=F6w?= | last post by:
I am currently designing a synchronized queue used to communicate between threads. Is the code given below a good solution? Am I using mutex lock/unlock more than needed? Are there any resources...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.