1

This is what I have done:

  • Download the 1.54 zip file from the boost website
  • Extracted/copied it to C:\Program Files (x86)\Boost
  • Inside Visual Studio I have set the include libraries to: C:\Program Files (x86)\Boost\boost_1_54_0\boost_1_54_0\

(This seems to work fine for getting the compiler to accept the libraries)

Now the bit i'm having problems with- linker:

  • Inside Visual Studio I have set the linker include directories to: C:\Program Files (x86)\Boost\boost_1_54_0\boost_1_54_0\libs\

When I compile my project I get:

fatal error LNK1104: cannot open file 'libboost_date_time-iw-mt-sgd-1_54.lib'

EDIT Have built the boost binaries using the answer below. However I now have these files:

libboost_date_time-vc110-1_54.lib
libboost_date_time-vc110-gd-1_54.lib
libboost_date_time-vc110-mt-1_54.lib
libboost_date_time-vc110-mt-gd-1_54.lib
libboost_date_time-vc110-mt-s-1_54.lib
libboost_date_time-vc110-mt-sgd-1_54.lib
libboost_date_time-vc110-s-1_54.lib
libboost_date_time-vc110-sgd-1_54.lib

but still no

'libboost_date_time-iw-mt-sgd-1_54.lib'

EDIT: Think I have found the problem:

http://lists.boost.org/Archives/boost/2004/08/70114.php

OK, here's the problem: originally we had one Intel toolset: "intel-win32" which created the library suffix "iw" (note no version number!), and this is what the auto-link header currently searches for.

However people have started adding versioned Intel toolsets, which means that we now produce an ad-hoc mixture of library names, some with compiler-version suffixes and some without, the autolink code could handle either form, but as it's not psychic it can't handle both :-(

Solution is to #define BOOST_ALL_NO_LIB

intrigued_66
  • 16,082
  • 51
  • 118
  • 189
  • 1
    Which version of Visual Studio are you using? 2010 and above support `std::shared_ptr` so you don't need to use the boost version. – Mgetz Nov 05 '13 at 20:20
  • @Mgetz 2012. Accepted, but even if I comment out the references to the boost::shared_ptr it still gives the same error. – intrigued_66 Nov 05 '13 at 20:30
  • most likely `file_mapping.hpp` is including that library in its tree somewhere as `mapped_region.hpp` wouldn't need it. – Mgetz Nov 05 '13 at 20:37

1 Answers1

3

On a 64bit system you should build boost in Program Files, not Program Files(x86) the boost automatic library include does not handle the redirection correctly. Alternatively you can manually manage the library inclusion... but I would highly recommend against it.

Also a reminder that you need to build boost in all the flavors and bitnesses you are going to use. See How to use Boost in Visual Studio 2010 for a good example of how to do so.

  • In an administrator visual studio command prompt go to the boost directory
  • run bootstrap.bat
  • run b2 --toolset=msvc-10.0 --build-type=complete architecture=x86 address-model=64
  • wait for b2 to finish building

EDIT:

As it turns out the iw in that library refers to the intel compiler... to use that with boost and visual studio you'll need to follow the directions from Intel.

Community
  • 1
  • 1
Mgetz
  • 5,108
  • 2
  • 33
  • 51
  • Thanks for the tip. Have changed my path and modified in VS but I still get the same error when rebuilding. I have also removed shared_ptr and still get the problem. Its to do with linking.... – intrigued_66 Nov 05 '13 at 20:33
  • 1
    have you built the correct bitness of boost for the program you're compiling? If you're building 64bit you need to build boost with `address-model=64` – Mgetz Nov 05 '13 at 20:36
  • Would I be better off using the 64 bit of this: http://boost.teeks99.com/bin/1.54.0/ ? – intrigued_66 Nov 05 '13 at 20:43
  • How do I enable that address-model=64 in VS? – intrigued_66 Nov 05 '13 at 20:44
  • 1
    Sounds like you need to rebuild boost then... otherwise it won't be able to find the libraries. – Mgetz Nov 05 '13 at 20:46
  • What do you mean by "rebuild boost"? I havent built them initially (I literally just did what I have posted above). I just extracted the folder, added the includes in my VS project. – intrigued_66 Nov 05 '13 at 20:57
  • 1
    @mezamorphic I've fixed my answer to include basic build instructions, but yes.... you'll need to build the libraries before boost will work properly for you. – Mgetz Nov 05 '13 at 21:01
  • Its taking a while- will let you know if it works when finished. Btw I changed "10.0" for "11.0" because I have VS2012. – intrigued_66 Nov 05 '13 at 21:22
  • btw whats the difference between b2 and bjam? – intrigued_66 Nov 05 '13 at 22:20
  • bjam is the build system, b2 is the auto build configurator, you can use bjam directly if you know what you're doing... but I would recommend using b2 as it takes care of all the painful stuff – Mgetz Nov 05 '13 at 22:22
  • Ok- good (thanks) but its now saying its missing: 'libboost_date_time-iw-mt-sgd-1_54.lib' which is similar to previous error, but not exactly? (I added the Linker reference to stage/lib/) – intrigued_66 Nov 05 '13 at 22:46
  • Correction- the error in previous comment is the same error as I originally had.... :s – intrigued_66 Nov 05 '13 at 23:04
  • I have libboost_date_time-vc110-1_54.lib, libboost_date_time-vc110-gd-1_54.lib, libboost_date_time-vc110-mt-1_54.lib, libboost_date_time-vc110-mt-gd-1_54.lib, libboost_date_time-vc110-mt-s-1_54.lib, libboost_date_time-vc110-mt-sgd-1_54.lib, libboost_date_time-vc110-s-1_54.lib, libboost_date_time-vc110-sgd-1_54.lib but not the one I need :s – intrigued_66 Nov 05 '13 at 23:09
  • hmm for some reason it doesn't seem recognize your compiler correctly in VS, iw is the compiler, you need to compile your project with the same compiler as boost – Mgetz Nov 06 '13 at 03:18
  • 1
    @mezamorphic you might want to read [this article from intel](http://software.intel.com/en-us/articles/intel-c-compiler-for-windows-fatal-link-error-lnk1104-when-using-intel-c-compiler-with-boost-libraries) if you intend to use the intel compiler – Mgetz Nov 06 '13 at 03:44