Skip to main content
gamedev.net
🔒 Locked

Boost

Started by Jedimace 9 replies 1.4k views
Original Post
Jedimace
Jedimace
I have my game engine I am working on, and I would like to have Boost as part of the project, so I want the Boost stuff to compile with the engine. I was trying to put the source into my project, but it couldn't find all of the .ipp files. Where and what are these?
-Jedimace1My company siteEmber StudiosAlmost Done
Jedimace
Jedimace
Wait. The .ipp files are there, but Code::Blocks didn't include them. How do I set it up with Code::Blocks?
-Jedimace1My company siteEmber StudiosAlmost Done
Jedimace
Jedimace
NVM, I figured out I can't really build Boost in my project, I have to build it separately and import it. Although, I will find a way to put it in my class without having to download it separately as a user of my game engine.
-Jedimace1My company siteEmber StudiosAlmost Done
Spoonbender
Spoonbender
Quote:
Original post by Jedimace
I have my game engine I am working on, and I would like to have Boost as part of the project, so I want the Boost stuff to compile with the engine. I was trying to put the source into my project, but it couldn't find all of the .ipp files. Where and what are these?


For most Boost libraries, you can just add all the .cpp files to your project, and it should compile. The .ipp files are #included as necessary.

However, the normal approach is to compile Boost separately and link to the generated libraries.

Quote:
Although, I will find a way to put it in my class without having to download it separately as a user of my game engine.

Huh?
If you use the dynamically linked version of Boost, you just have to bundle a couple of .dll's with your game. If you use the statically linked version, you don't have to distribute anything, other than the game itself.

You don't need to compile Boost as part of your project for that. Compile it separately, once, using bjam as explained on http://www.boost.org. Then just link to the libraries you want.
Jedimace
Jedimace
Ok, well I have all the parts of Boost I want to include in my game engine through a static link. How do I statically link to Boost, so my project can be distributed to others(the source) and they can compile it without needing Boost?
-Jedimace1My company siteEmber StudiosAlmost Done
ToohrVyk
ToohrVyk
Quote:
Original post by Jedimace
How do I statically link to Boost, so my project can be distributed to others(the source) and they can compile it without needing Boost?
Code which uses boost needs the boost headers to compile. So, you can't.
Jedimace
Jedimace
Then can I put Boost in my project so the user does not need to download it with the code?
-Jedimace1My company siteEmber StudiosAlmost Done
Jedimace
Jedimace
Also, Boost does have some C++ files that need compiling for some of the libraries, like the Python library.
-Jedimace1My company siteEmber StudiosAlmost Done
MrMark
MrMark
If you copy the .h .cpp files into your project folder then add those files to your project Visual Studio will compile them into your exe. This one way of doing static linking. It's called static since you can't change the version of boost you are using without recompiling. Boost just becomes another bit of code in your project.


edit: missed the bit about using code blocks. Effectively the same, just add the required boost files into your project; Don't add the whole thing it'll blow out your executable big time.
Spoonbender
Spoonbender
You include Boost in exactly the same way you'd include any other library.

First, you compile the library (unless you can download a precompiled version).
This gives you some .dll files and/or some .libs.

In your code, you #include the relevant header files from the library, and you then set the linker options to link to the relevant .lib file from the library.

The .lib file will get linked into your file, so you don't need to distribute that with your game. If it calls out into a .dll, that dll will have to be distributed.

Boost enables both variants. All the libboost*.lib files are for the .lib-only versions of the libraries, and the boost*.lib files are simple stubs which take care of loading the relevant .dll and calling into that. So link to the version you need, and if you choose the dll version, bundle the dll's with your application.

Note that there's nothing Boost specific in this. It's how you'd link to any library.

[Edited by - Spoonbender on October 21, 2008 3:39:35 PM]
Jedimace
Jedimace
Thank you, that is exactly what I needed. I can now start on my project!
-Jedimace1My company siteEmber StudiosAlmost Done

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.