Game Development Community

Compile errors when using STL vector or string, or Boost::Python

by Jonathan French · in Torque Game Engine · 10/23/2006 (8:36 am) · 1 replies

Hi,

I'm the latest Torque HEAD, and I'm trying to integrate Python scripting using Boost::Python (yes I know there's TGEPython but it's quite old and just wraps the entirety of the C++ API, and I'm trying to make the ConsoleFunction etc macros define Python functions instead), but I get compile errors whenever i #include in console.h:

http://pastebin.com/811965 (Linked because it's large, larger than the forum limit)

This also happens with the standard string and vector headers; either of those three triggers these errors, and when I remove the #includes, the errors disappear.

Here's the code with which I've replaced ConsoleFunction, which appears to be causing the "returnType not a type" warnings:

std::vector<std::string> pythonFunctionNames;
std::vector<boost::python::object> pythonFunctionImpls;

#define ConsoleFunction(name, returnType, minArgs, maxArgs, usage1) \
	static returnType name(SimObject *, S32, const char **argv); \
	pythonFunctionNames.push_back(#name); \
	pythonFunctionImpls.push_back(boost::python::def(#name, &name); \
	static returnType name(SimObject *, S32, const char **argv)

I did it that way, with the vectors, to be able to import it into the main namespace using the Boost::Python __dict__ functions. This doesn't however seem to be causing the main problems: as I've said, without #including either of those three headers, there are no fatal errors.

I'm using Ubuntu Dapper, fully up to date etc, and have all the necessary dev packages installed... can anyone help?

About the author

Recent Threads


#1
10/23/2006 (10:24 am)
Check out the TDN, their should be a resource/article about disableing TGE's memory management to allow for one to use STL.