Building Boost C++ lib for MINGW and coding in Code::Blocks

+

Boost C++ Libraries is one of the most highly regarded and expertly designed C++ library projects in the world. It provides many efficient algorithms to help App developers to improve their program. However, the Boost’s official website offers only source files and Build Tools ( Boost JAM ), we must build the suitable Lib according to the compiler ( like GNU GCC Compiler, Borland C++ Compiler or VC++ Compiler ). Althought, there’re many pre-builded destro providered by some unofficial website, most of them are for VC++ Compiler.

Here’s a tutorial for building Boost C++ Lib for MINGW GCC Compiler.

[b] * First of all, Download Boost from the Boost website. You will need the actual Boost package (source) and the Boost Jam package (binary NTx86). Unpack the first package to any location on you harddisk and unpack the file "bjam.exe’’ from the second package to a directory contained in your search path (e.g. "C:\MinGW\bin’’ or “C:\Program Files\CodeBlocks\MinGW\bin”).

  • Then open a shell (cmd.exe) and change into the directory you have unpacked the Boost package to. Type the following command:
    C:\…\boost_1_35_0\>bjam --toolset=gcc --prefix=C:\Boost install
  • While building, it’ll take 30 mins up to couple hours depends on your machine. So be patiant.
  • Then Boost C++ Lib will be installed in “C:\Boost\include\boost-version”[/b]

After that. we can use Boost to code for MINGW GCC Compiler in Code::Blocks IDE. Before coding, add the Boost “include” and “lib” into the compiler search dictionary.
[b]

  • Open the Code::Blocks IDE, then click on “settings” → “compiler and debugger…”, change to “search dictionary” page and add “C:\Boost\include\boost-1_35” into “compiler” page.[/b]

    * Then add “C:\Boost\lib” into “Linker” page.

Creat a new Console Application project for C++, click “Project” → “Build options…”. Add the lib you need in your project (e.g. C:\Boost\lib\boost_signals-mgw34-mt-1_35.lib)

Then code following code in main.cpp

[code]// Boost.Signals library

// Copyright Douglas Gregor 2001-2003. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

// For more information, see http://www.boost.org

#include
#include
#include
#include

struct HelloWorld
{
void operator()() const
{
std::cout << “Hello, World!” << std::endl;
}
};

int
test_main(int, char* [])
{
// Signal with no arguments and a void return value
boost::signal sig;

// Connect a HelloWorld slot
HelloWorld hello;
sig.connect(hello);

// Call all of the slots
//sig();
return 0;
}[/code]

Compilation will be completed.

If you have any question, it’s great to post in comment :slight_smile:

Reference:
http://mvlab.blogspot.com/2008/05/building-boost-c-lib-for-mingw-and.html

can you explain to an idiot how this would help the gserver? what was is multithreading support?

A lot more things can run in parallel instead of waiting for each task to finish itself to be able to do the next task.

Eg: When a player downloads a big file, everyone has to wait for that big file to send in order for any further server related actions can occur.

I never get too far in using this, it’s a pain in the ass.

ah…that does sound helpfull.

You guys rock. This is going to be a huge improvement!

with this boost, we gonna be able to support a lot more players? like the p2p graal?

We did support that many players already (You must mean the 45 people on at the same time). :stuck_out_tongue: Well, our current servers support up to 120 players and more. We don’t have that tested, but it’s all about the connection and hardware. :stuck_out_tongue:

Thankiez

Just to clarify, does the next client use boost threading aswell?

Example: I’ve tryed making a mng video to play in graal, but being a larger file takes awhile before it starts, and all other scripts stop running, waiting for the play file; line to finish executing.

Should it now open that file in chunks, well running other scripts simultaneously?
*in this situation I’m implying the player already has the mng video downloaded, just loading to memory.

That has nothing to do with the client. It has to do with the servers download time. And just to clarify: MNG is not a video format. It’s an animated PNG format. It doesn’t support built in audio or any kind of video encoding thus making it a big raw motion picture.

is he trying to make a movie theater? that sounds like an interesting idea.

Been there, done that, its called using a Gani. Much easier. Theres also a ‘Movie/Actor/Theatre’ mode in the Gani editor (with exception to the -extremely- old one).

I should have described it better. In my scenario this is in offline testing. I made a mng file (animated png), of an intro movie, that plays at the same time as a mp3 file. It works allready, like it’s supposed to, but loading time sucks. By saying it was a big file taking awhile to load, I mean the script freezes for 10 seconds (you can tell by the sound stopping and no button response), I don’t mean it downloading the file, it’s just graal’s handling of loading large files.

My question is just asking if the newer version clients make use of boost threading too or no?