Can't build with the boost librarys

Started by
7 comments, last by Simulacrum 14 years ago
I downloaded and installed the Boost librarys, but when I just add the new include directory, my compiler doesn't compiles anything. Strange is: It says 0 Errors, build successful, etc. But When I press the "Play" -button (aka start debugging button) VC++ tells me, that my programm .exe wasn't found. I looked into my debug folder, but there was nothing. How can that be? It compiles fine without the additional path...
Advertisement
Are you expecting your compiler to compile every file in every directory in its include paths?
I did it like they wrote on their page:


Quote:
4.1
#

In Configuration Properties > C/C++ > General > Additional Include Directories, enter the path to the Boost root directory, for example

C:\Program Files\boost\boost_1_35_0

#

In Configuration Properties > C/C++ > Precompiled Headers, change Use Precompiled Header (/Yu) to Not Using Precompiled Headers.3

http://www.boost.org/doc/libs/1_35_0/more/getting_started/windows.html

And I just include the Foreach.hpp.
Do you have added a main-function?
Quote:
Do you have added a main-function?


-.-'

I know you think I am a noob. Well, I think somewhere I've added a main function in my project with nearly thousand pages of code. Im not THAT stupid. Please stopp that. It's just childishly.

But anyways, somehow it works now.
Little buddy he was just trying to help there's no need to get offended. Even though it can be frustrating, try to learn to just answer the questions people ask. Otherwise, how can they help you if they don't know?

It's like when someone says their computer won't turn on. It doesn't matter HOW smart they are, you always ask them first "Is the power cord plugged in?"... just in case!
Quote:Original post by WuTz
Quote:
Do you have added a main-function?


-.-'

I know you think I am a noob. Well, I think somewhere I've added a main function in my project with nearly thousand pages of code. Im not THAT stupid. Please stopp that. It's just childishly.


It is not uncommon to hack together a tiny proof-of-concept before directly plugging something into a real application. And then, it might perfectly happen that one forgets the main function.

Nothing to do with us thinking about you as a noob, so please stop assuming assumptions from our side. If you don't want answers, don't ask in the first place.


Quote:But anyways, somehow it works now.

Maybe post your solution. Have you rebuilded from scratch?
Sorry about that. I thought you said this because of the thread from yesterday...

Well, yesterday I decided to change all my Foreach maros (You know them) into those BOOST_FOREACHs. I replaced them about 150 times by hand, because parameters where swapped, a missing brace, no (*Out), and the BOOST lib was still downloading at this time. So, at about 2:00AM I was finished, and BOOST, too. So I put it into the folder, and tried to compile. Didn't worked, I was pissed and I gone to sleep. Today it works.

Maybe because of the restart of MSVC++?
If you don't mind starting over try this. (I've no idea if you compiled the boost libraries correctly)

Hit the start button and type cmd.exe

use the cd command to navigate the directory where you extracted your boost installation.

enter: bootstrap.bat

This builds bjam.exe

enter: .\bjam.exe -a -j2

This will build all the boost libraries. -j2 is for one/two core processors. Increase it to -j4 if you have a quadcore. If you have both MSVS9 and MSVS10 installed you will need to add the option -toolset=msvc-9.0 to build for MSVS9 and so on and so forth for all the other iterations of MSVS that you use.

Open MSVS and select "Tools->Options->Projects and Solutions->VC++ directories"

From here you can update the include paths and library paths to reflect that you have boost installed on the system. Only do this if you want boost to be available for all your projects...boost is indespensible for me so this is what I do. BE VERY CAREFUL NOT TO DELETE ANY OF THE DEFAULT PATHS IF YOU HAVE NOT DONE THIS BEFORE.

After you do this open the project where you attempted to use the BOOST_FOREACH macro. Next open the specific file you attempted to use the BOOST_FOREACH macro in.

Make sure you have included: #include <boost/foreach.hpp>

From here you should be all set to use the foreach macro in the file you specified that specific preprocessor directive.

------------------------

I'm going from memory here so if I missed a step don't kill me. I'll be happy to try and help you. The BOOST_FOREACH macro is much better than any like macro you or I will probably conjure up without days or weeks to look into it. This is why I sincerely hope you adopt it over using your own.

In general it is better to use "good and appropriate" existing solutions than re-inventing the wheel yourself. Just be sure what you're using is actually good and is actually appropriate given your constraints and what you intend to accomplish.
The difference between a dream and reality is only what you choose to do about either of them.

This topic is closed to new replies.

Advertisement