Compiling RakNet With g++ 4.3 Fails

When choosing a networking library for a Crystalspace/CEL project of mine, my heart was set on RakNet. The RakNet library offers many features and does so in a way that makes it easy to integrate into almost any project.

Raknet is a cross-platform C++ game networking engine. It is designed to be a high performance, easy to integrate, and complete solution for games and other applications.

http://www.jenkinssoftware.com

Unfortunately, on my Ubuntu Jaunty system, g++-4.3 was installed by default which caused RakNet to fail on compilation. There were a bunch of errors in the DS_Map.h include file, including:

../Raknet/DS_Map.h:90: error: template argument 3 is invalid

After some trial and error I found that if you install the g++-4.2 development package and use the g++-4.2 binary, RakNet compiles and runs just fine.

From a terminal window:
sudo apt-get install g++-4.2

After installing the package above, I also needed to change which g++ binary my Eclipse project was using. I did this by going to the “Project” menu and clicking “Properties”. When the Properties window opens, click on “C/C++ Build” on the left side, then click on “GCC C++ Compiler” on the right. Where it shows the command to be run, change the command to read: g++-4.2.

eclipse_gcc_42


© 2018 All logos and trademarks are copyright their respective companies.