views:

288

answers:

2

What do I need to do to include boost::thread in my project? I have copied the whole thread folder to my working path (I wish to be able to run this on several computers) and I get

fatal error C1083: Cannot open include file: 'boost/thread/detail/platform.hpp': No such file or directory

From the line #include "thread/thread.hpp"

What gives?

edit: Even if I just link to the boost folder where the precompiled binary installed and I use #include <boost/thread/thread.hpp> I get

fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-1_41.lib'

+4  A: 

Unfortunately boost::thread is not a "header-only" library -- hence you need to have it compiled. There are basically two ways to go around it.

  1. you download a prebuilt install package from boostpro (assuming that you are on windows) -- http://www.boostpro.com/download
  2. you can build it yourself - see http://www.boost.org/doc/libs/1_35_0/more/getting_started/index.html
Kornel Kisielewicz
I downloaded the prebuilt installation package, but I'd like to include the boost::thread stuff within the compilation of my project (which I'm sure will make it larger, but I'd like to run it on many computers that may not have boost installed)
Chris
@Chris, there are statically linked distributions of the libs from boostpro... this means you just have to link to the library and it will be included in your compilation. This way, you don't need to try and build the boost library yourself (ofc, assuming you are on windows).
Polaris878
@Polaris I'm currently on Windows, but will be running this application on some linux machines as well (thus the choice of boost::thread)
Chris
@Chris, in that case you'll need to get friendly with Boost.Build :)
Kornel Kisielewicz
Depends on your linux distro. On Debian (and I expect most/all Debian derivatives), boost::thread is just a quick "aptitude install libboost-thread-dev" away.
timday
A: 

Fatal Error C1083 is a Visual C++ error. You should include the library folder from boost in your project. "C:\Program Files\boost\boost_1_41\lib" if you're using boostpro.

Also when you're downloading the thread library with boostpro, you need to check it in the list (you can also choose the compiler...).

anno