Original Post
A few nights ago I discovered my Python Matrix class was a significant bottleneck in my game. I decided to finally dip my hand back in C++ after a two-year hiatus and learn about writing Python extensions. I started looking at Boost Python on Tuesday night, and have spent quite a few hours trying to get it to work, without success. Maybe I'm just forgetting my C++, but the setup process for Boost seems obscenely difficult. Here are the tutorials I've been working with to get it installed: Boost Getting Started Visual C++ Express Boost Setup Notes Here is a step-by-step scenario of what I've done, so far: 1) Downloaded boost_1_33_1.zip from SourceForge and unzipped the boost_1_33_1 folder to C:\Program Files. 2) Installed Visual C++ Express. 3) Downloaded the Platform SDK. 4) Setup Platform SDK with Visual C++ Express 5) Set PYTHON_ROOT, PYTHON_VERSION, and VC80_ROOT environment variables. 6) Built Boost using this command: bjam "-sTOOLS=vc-8_0" install I now have a C:\boost folder, which contains all the Boost header files in the include folder, and a bunch of DLL and LIB files. Here is the list of python library files: boost_python-vc80-mt-1_33_1.dll boost_python-vc80-mt-1_33_1.lib boost_python-vc80-mt.lib boost_python-vc80-mt-gd-1_33_1.dll boost_python-vc80-mt-gd-1_33_1.lib boost_python-vc80-mt-gd.lib 7) Created a new Empty Project in Visual C++ Express. 8) In Project Properties, I set the following for both Debug and Release builds... Configuration Type: "Dynamic Library (.dll)". Additional Include Directories: "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include";"C:\Program Files\Python24\include";"C:\Boost\include\boost-1_33_1\";"C:\Program Files\boost_1_33_1" Additional Library Directories: C:\Boost\lib;"C:\Program Files\Python24\libs" Generate Debug Info: YES 9) I then created a Matrix class and added the following code for Boost Python: 10) Building my project yielded 27 linker errors: *** LINKER ERRORS REMOVED TO REDUCE CRAZY WIDTH OF THREAD *** How can I resolve these errors? The path to the Boost library files is set, so my only guess is that it isn't looking for one of the boost_python_X files that exist there. Any thoughts? [Edited by - doctorsixstring on May 18, 2006 8:39:49 AM]
#include <boost/python.hpp>
using namespace boost::python;
BOOST_PYTHON_MODULE(matrix)
{
class_<Matrix>("Matrix")
.def("Identity", &Matrix::Identity)
.def("Translate", &Matrix::Translate)
/* etc. */
;
}