views:

63

answers:

2

Sorry for what seems like a silly question: But I've never, ever worked with boost, until tonight, and I'm finding that getting it configured seems to be harder to use than it should be.

I wanted experiment with it tonight. So I downloaded the zip file, and unzipped it to a directory here:

F:/boost_1_44_0

Then I created an empty c++ project in visual studio 2010 (not using pch either). So all I wanted to do was to include a header file. But not even a silly thing like that seems to work. Now I've been using visual studio for years, though at work we are still stuck on vs 2008 (That is another story). So usually what you do is set an include directory, and then you can include files in at will right?

So I set the global include directory to include the boost root. i.e. Property Manager -> My configuration (debug|win32) -> Microsoft.Cpp.Win32.user -> Common Properties -> C++ Directories -> Include Directories. There I added my path to f:/boost_1_44_0.

I also went to the project properties and set the C++ include directory for the project to point to the boost root like in vs 2008.

I then added a silly include declaration like so:

#include <boost/lambda/lambda.hpp>

But, amazingly it fails to compile!!! with the following error:

Error 1 error C1083: Cannot open include file: 'boost/type_traits/transform_traits.hpp': No such file or directory f:\boost_1_44_0\boost\lambda\core.hpp 25 1 test_boost

Which when I double click it, it opens up in f:\boost_1_44_0\boost\lambda\core.hpp, and takes me to this line:

#include "boost/type_traits/transform_traits.hpp"

So I have no idea what's happening. Is visual studio just not delivering up my global include paths that I set? It seems also that the include directive in core.hpp should be using angle brackets and not quotes.

If I'm doing something wrong what?

EDIT: !! SOLVED !!

Before I didn't have all the files unzipped. I don't know what happened. So I re-downloaded the zip file, and unzipped it again. This time the zip file took much longer to unzip, and it extracted much more files: Including the missing files. Problem solved, my hello world app compiles just fine now.

+2  A: 

The behaviour of compilers in locating header files is implementation defined for both the <> and "" variants.

However, based on this page for VC2010, it appears the quoted form searches a superset of the angle bracket form so I'm not sure that's the problem.

I suppose it would be a silly question to ask if the following file actually existed?

f:\boost_1_44_0\boost\type_traits\transform_traits.hpp

So, a couple of investigative jobs:

  • Make sure that f:\boost_1_44_0\boost\type_traits\transform_traits.hpp exists.
  • Try changing your top-level include to use quotes.
  • Try changing the include in f:\boost_1_44_0\boost\lambda\core.hpp to use angle brackets.
  • Make sure you try all four possibilities for those last two.
  • Is f: a network-mounted drive? What happens if you put it all on c:?

That last one is just in case Windows is doing some shenanigans under the covers :-)

paxdiablo
So this file:F:\boost_1_44_0\boost\lambda\core.hppincludes this file:#include "boost/type_traits/transform_traits.hpp"which files doesn't exist.Though there isn't even a type_traits folder!!So I'd say something is really screwed up in the boost distribution.I'll try the boost installer instead of using the zip file, since the zip file seems to be beyond broken.
C Johnson
You first bullet point caused me to do some investigation which lead me to discover that not only was a file missing, but complete directories of files were missing from my install. Re-downloading the boost files from the website and unzipping again led to the answer.
C Johnson
@C Johnson, I just downloaded the 7zip package from http://sourceforge.net/projects/boost/files/boost/1.44.0/boost_1_44_0.7z/download and it's definitely in there so two questions. 1/ Where did yours come from? 2/ Did you use the Windows Explorer built-in zip file handler or a real one? I've had troubles with the Windows one before, not grabbing all files. If that's so, get your hands on 7zip.
paxdiablo
A: 

While it's a bit overkill for this, learning to use SysInternals' Process Monitor will pay off over time. It will show you what files are actually opened, and which attempts failed. Look where Visual Studio tries to read transform_traits.hpp from, and you'll probably have the answer.

MSalters