Finding the include library

Pages: 12
How do I reconfigure C++ 2010 so it can always find the boost include directory library when I put an
#include <boost_1_47>
statement in my code (I hope this include statement is correct)? The full path is:
c:\program files (x86)\boost\boost_1_47
If you mean that you want to do it on a global basis (available for all projects) rather than on a project by project basis - see here.
http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/a494abb8-3561-4ebe-9eb0-6f644a679862
Follow these steps:

1. open up visual studio and create new project.
2. click on view > property manager
3 right click on your project name and click add new project prperty sheet
4. in add new item dialog type Boost.props into name field, into location type C:\ and click OK
5. double click on newly created project property sheet to open it
6. goto user macros and click on add macro
7. into name field type BOOST, and into value field type c:\program files (x86)\boost\boost_1_47 check the box "set this macro in enviroinment variable" and click OK
8. click on VC++ directories > include directories and append $(BOOST)\include respecting the semicolon!
EDIT: click on VC++ directories > executalble directories and append $(BOOST)\bin
9. Linker > general > aditional library directories and append $(BOOST)\stage\lib
10. Linker > general > link library dependencies set to *YES*
11. Finaly click apply and close project property sheet
12. In project proerty manager right click on your new sheet and click save

Now whenever you create new project and you wish to have boost libraries available all you have to do is add the exiting project property sheet previously created into your project.

to do that goto:
property manager > right click your project name > add exiting property sheeT and navigate to C:\ select the Boost.props and clik OK


NOTE:
all that will work if you have manualy compiled boost libraries!
Your project property sheet *MUST* be on top of other property sheets in property manager because this is the order of hieracy.

If you have problems just ask :)

Edited to add forgoten notes
Last edited on
codekiddy, thanks for exelent instructions. I created a property sheet according to the directions, however I'm not sure just what the
*#include* statement should look like. So far i'm using #include <boost/boost_1_47.hpp> and I'm getting the following errors:

1
2
Error	1	error C1083: Cannot open include file: 'boost/boost_1_47.hpp': No such file or directory line 15
	2	IntelliSense: cannot open source file "boost/boost_1_47.hpp" line 15


How can I correct these errors?

1
2
3
4
NOTE:
all that will work if you have manualy compiled boost libraries!
Your project property sheet *MUST* be on top of other property sheets in property manager because this is the order of
 hieracy.

Sorry, I used an installer provided by boost to install the libraries, does that make a difference?

... again, thanks for your help! . . . therry
#include <boost/boost_1_47.hpp>

your includes should look like this one for example:
#include <boost\thread\locks.hpp>

when you type <boost\ it should offer you few directories to choose next.

because you've setup c:\program files (x86)\boost\boost_1_47 as root directory all your searches are done from that point.

BOOST\include is where headers are. look into that directory and see if headers are there, that is c:\program files (x86)\boost\boost_1_47\include

Sorry, I used an installer provided by boost to install the libraries, does that make a difference?


make sure that *.lib files are located inside c:\program files (x86)\boost\boost_1_47\stage\lib

if not then maybe in c:\program files (x86)\boost\boost_1_47\lib

I can't say what did instaler do and how did instaler compile all that so you'll have to check every directory manualy and setup that directories in property sheet respectively.

Most important are include, lib and bin directory. all are located in c:\program files (x86)\boost\boost_1_47

You can also check the manuals on boost web page, thats how I setup my propery sheet :)

My program still cannot open the #include <c:\Program Files (x86)\boost\boost_1_47\lib\>
I get the following errors:
1
2
Error	1	error C1083: Cannot open include file: 'c:\Program Files (x86)\boost\boost_1_47\lib\': No such file or directory
	2	IntelliSense: cannot open source file "c:\Program Files (x86)\boost\boost_1_47\lib\" 

Is my #include statement correct? This is what I have in my PropertySheet (To see the property manager in my view window I had to change the settings to expert)

1
2
3
4
Common Properties -> General -> Output Directory = $(SolutionDir)$(Configuration)\
Common Properties -> General -> Intermediate Directory = $(Configuration)\

Common Properties -> User Macros = BOOST  c:\program files (x86)\boost\boost_1_47

Should I go deeper in the User Macros, like down to c:\program files (x86)\boost\boost_1_47\lib?

1
2
3
4
5
6
7
8
9
Common Properties -> vc++ Directories -> Executable Directories = $(BOOST)\bin;$(ExecutablePath)
Common Properties -> vc++ Directories -> Include Directories = $(BOOST)\include;$IncludePath)

Common Properties -> C/C++ -> General -> Additional Include Directories =
 c:\Program Files (x86)\boost\boost_1_47\lib;%(AdditionalIncludeDirectories

Linker -> General -> Additional Library Directories = $(BOOST)\stage\lib;%(AdditionalLibraryDirectories)
  		Link Library Dependencies = Yes
		Use Library Dependencies Input = No


Please advise where I'm wrong. . . . Thanks!








codekitty, I think the installer did something crazy during the installation process. I think I'm going to uninstall the boost library and try to instal it manually. It would be nice if you could give me an instruction set as to how to install it manually. I wish to instal the library on *c:\boost\boost_1_49* instead of *c:\Program Files (x86)\boost\boost_1_47* because I want to install the 64bit system instead of the (x86) system. I run windows 7 64bit with C++ 2010 Express compiler. Your help will be greatly appreciated!!! Thanks . . . . therry
Sorry, my computer crashed. When all was corrected, I downloaded boost_1_49_0 in a *c:\boost_1_49_0* folder. Inside is another: boost_1_49_0. Inside the second folder I find 7 folders -- boost, doc, lib64, libs, more, status, & tools; plus a boost-build.jam file, a boostcpp.jam file, a bootstrap file, bootstrap.sh file, 2 Index Firefox HTML files, an Install file, a jamroot file, a license_1_0 file, and a rst file.
Your help will be greatly appreciated!!! Thanks . . . . therry
Hi therry,
#include 'c:\Program Files (x86)\boost\boost_1_47\lib\

You tryed to include *.lib file ? that of course can't work...
I would advise you to learn about differences between libraries, headers and dll's.


OK, I'll try to give you detailed instructions to setup your boost libraries, first follow these steps:
go to official boost web page and download current release:
http://www.boost.org/users/download/ (the file to download is called boost_1_49_0.zip)

Extract the downloaded file into C:\ root directory
when you do that you will have a directory whose path is:
C:\boost_1_49_0

Now all you have to do are 2 things:
- build boost libraries for your enviroinment.
- set propertiy sheet for your enviroinment projects.


To build you libraries do this:
goto Start > All programs > Visual studio 2010 > Visual studio tools
here select visual studio command promt. (64 bit one if you have x64 machine)
when cmd opens
type cd C:\boost_1_49_0
type bootstrap.bat

to see all available command line options goto this site and study:
http://www.boost.org/boost-build2/doc/html/bbv2/overview/invocation.html

to see official instructions goto this site and study
http://www.boost.org/doc/libs/1_47_0/more/getting_started/windows.html#build-from-the-visual-studio-ide

Please study from these sites before you say "it doesn't work" becuase I know it works OK?

here are simple options that I used for my build
for 64 bit system
type b2 --toolset=msvc-10.0 --build-type=complete architecture=x86 address-model=64 stage link=static,shared threading=single,multi

for 32 bit sysem
type b2 --toolset=msvc-10.0 --build-type=complete stage link=static,shared threading=single,multi

Now at this point take a coffie break, this process will take houres to complete, do not disrupt the command promt until finished!!


Second step is to setup your property pages.

edit: here is edited version that works with new boost libraries
1. open up visual studio and create new project.
2. click on view > property manager
3 right click on your project name and click add new project prperty sheet
4. in add new item dialog type Boost.props into name field, into location type C:\ and click OK
5. double click on newly created project property sheet to open it
6. goto user macros and click on add macro
7. into name field type BOOST, and into value field type c:\boost_1_49_0 check the box "set this macro in enviroinment variable" and click OK
8. VC++ directories > include directories and append $(BOOST) respecting the semicolon!
9. Linker > general > aditional library directories and append $(BOOST)\stage\lib
10. Linker > general > link library dependencies set to YES
11. Finaly click apply and close project property sheet
12. In project proerty manager right click on your new sheet and click save

Have a nice build :D
Last edited on
I still cannot open the #include file. I just purchased visual Studio Professional so I wouldn't be limited by the limitations of c++ 2010 Express, build the libraries using bootstrap, then from the 64bit command promp built the boost library using the command *bjam -a -d+2* When the build was complete I got the message:
1
2
directories should be added to compiler include paths = c:/boost_1_49_0/boost_1_49_0
directories should be added to linker paths = c:\boost_1_49_0\boost_1_49_0\stage\lib

To create the new property Sheet, Under Use Macro I have:
Name = boostsheet & value = c:/boost_1_49_0/boost_1_49_0

Under Executable Directory I have:
$(BOOST)\include;$(ExecutablePath)

Under c/c++ general I have:
c:\boost_1_49_0\boost_1_49_0;%(AdditionalIncludeDirectories)

Under Linker -> General -> Additional Library Directories I have:
c:\boost_1_49_0\boost_1_49_0\stage\lib;%(AdditionalLibraryDirectories)

But when I try to build I get the following error:
1
2
1>15): fatal error C1083: Cannot open include file: 'c:/boost_1_49_0/boost_1_49_0': Permission denied
1>Build FAILED.

How can I correct this error? Again, as always, thanks for your help....therry
Hi terry,
You didn't follow my directions, why?
I can't help you if you don't follow my instructions, I'm sorry.

Also the bjam's output has told you all you have to know.

VC++ directories > include directories > c:/boost_1_49_0/boost_1_49_0

Linker > general > aditional library directories c:\boost_1_49_0\boost_1_49_0\stage\lib

this step is if you bild your libs dynamicaly
VC++ directories > executable directories c:\boost_1_49_0\boost_1_49_0\bin

Please learn the differences between executables (dll's) and header files

here I uploaded an example of boost property sheets.
http://uploading.com/files/db7b9b38/Boost.zip/
It will not work in you case, but here you are to see an example.
Sorry codekitty, but I really did try to follow your instructions. When they didn't work for me, I thought it was because I was running the Express version of c++ 2010. That is why I purchased visual studio 2010 professional. When I tried to follow your instruction in the pro. version, it told me that b2 was not a valid command and neither was bjam. I did not know that I had to bootstrap before using the b2 or bjam commands. I tried Google and read more. It was through trial and error that I discovered the *bjam -a -d+2* command. I did build something, but I don't know exactly what. I followed the instructions to add the new directories as instructed, and got those error codes. As of yet, I do not know how to check if all the libraries were build, or if they were build correctly. Also I'm not sure if it is a smart move to try to rebuild, or how to go about it. If you can help, this newbie sure would appreciate it.
When I tried to follow your instruction in the pro. version, it told me that b2 was not a valid command and neither was bjam. I did not know that I had to bootstrap before using the b2 or bjam commands


You didn't know that you had to bootstrap before using the b2 ?

here is a Quote from my post that let's you know:
goto Start > All programs > Visual studio 2010 > Visual studio tools
here select visual studio command promt. (64 bit one if you have x64 machine)
when cmd opens
type cd C:\boost_1_49_0
type bootstrap.bat

for 64 bit system
type b2 --toolset=msvc-10.0 --build-type=complete architecture=x86 address-model=64 stage link=static,shared threading=single,multi

for 32 bit sysem
type b2 --toolset=msvc-10.0 --build-type=complete stage link=static,shared threading=single,multi

Now you see.

I can't help u at this poing since you don't know how did bjam build your boost libraries.
If you wish to build again following abowe notes then delete old build and start from begining.

if you do not wish to build again then learn about property sheets on MSDN to setup your build of bjam with your Visual studio.


Also you didn't need to purchase Visual studio pro, the above steps works with express edition as well.


If I type bootstrap.bat, will that delete my old build?... or must I do something else to delete the old build? Thanks for your help. . . . therry
delete current boost folder completly from your C drive (or move it somewhere else) and extract the zipped libraries downloaded from boost to your C partition.

then follow the steps as already mentioned.

I hope you'll succeed this time :)

edit:
I've send you PM, check it out.
Last edited on
It is really important that I learn what I am doing wrong. I decided to delete all boost from my c disk and start over again.
I deleted the boost folder and redownloaded boost from boost.org, unziped using 7z as recommended, installed it into c:\boost\boost_1_49_0, opened the win64bit command prompt, typed: cd c:\boost, then cd boost_1_49_0, then typed bootstrap.bat and got the following:
1
2
3
4
5
6
7
8
9
10
 Building Boost.Build engine

Failed to build Boost.Build engine.
Please consult bootstrap.log for further diagnostics.

You may try to obtain a prebuilt binary from
http://sf.netproject/showfiles.php?group_id=75868package_id=72941

Also, you can file an issue at http://svn.boost.org
Please attach booststrap.log in that case.


I searched my computer for the bootstrap.log without success. Either bootstrap.bat did not make one, or the search engine on my computer could not find it. I do not want a prebuilt as that will teach me nothing. Also, I can't file an issue because I can't find the bootstrap.log file. I'm not sure what to do, other than to start all over again.
WAAHOO! I found the problem. About a year ago I installed Yogi security on my computer to stop hackers. It didn't recognize what I was doing so it kept interrupting the installation process. Since my year was almost over anyway, I deleted it from my computer and reinstalled boost, following your instructions. Everything worked perfectly. Now I want to install the property sheets globally instead of per user. That way I won't have to go through the bother of assigning a property sheet for every new project. Does your instructions install the property sheets globally or per user? Again, I really appreciated your patience while dealing with my seeming stupidity. . . . .therry
Ok, that's it :D
I'm realy glad you got everything in oreder :)

Does your instructions install the property sheets globally or per user?


No, You can't install property sheet for all projects or globaly.
You'll have to include property sheet for every new project you create in Visual Studio, that's new feature since visual studio 2008.

But that is no problem, just make sure you have a property sheet created and saved somewhere in your computer, for example as already mentioned, save it into C:\ directory.

now when you create new project follow the steps alreday discusted in my earlier post.

I'll repeat that just for case:
to do that goto:
property manager > right click your project name > add exiting property sheeT and navigate to C:\ select the Boost.props and clik OK


This step of course assumes you have saved Boost.props in C:\ directory.

Kind regards!

@codekiddy
Would you consider drafting a generic version of these instructions? Seems to me it would make an excellent article for this site, I definitely intend to follow it and create an SFML property sheet. I was (breifly) looking into creating an SFML project wizard for VS2010 (which I still want to do) but looks far to complicated for the limited time I have these days.
Hi naraku,
I don't use SFML but it looks to me that SFML SDK have prebuild libraries for various visual studio editions and processor types, so all you need is a property sheet configured for SFML.

Note that only Visual studio editions older then 2008 have property sheet features. older editions have this setup globaly for all projects.

Also note that if you have 64 bit machine and visual studio 2010 then you'll have to build SFML from source.

What visual studio edition do you use?

EDIT:
Would you consider drafting a generic version of these instructions?

Sorry but no, It would be hard for me or anyone else to create such tutorial becuase different libraries or SDK's have different folder architecture, which means that most beginers wouldn't be able to setup their property sheets.

For example I've build 64 bit CEGUI libraries for my enviroinment recently and there are no such steps to help someone setting up this, CEGUI drived me like a crazy for houres. tutorial would take probably 30 pages to complete :D
and even then new questions would arise.

The best way is to read a documentation and solve the problem on your own.
Last edited on
Pages: 12