I try to build simple hello world with boost python and
visual c++ 2008 express.
I included path E:\Program Files\boost\boost_1_47\ inside
|Tools|Options|VC++ Directories| for Include files (and tried to put same path to all other),
but i still get error
'boost' : is not a class or namespace name
source code is:
#include <boost/python.hpp>
#include "stdafx.h"
using namespace boost::python;
int main( int argc, char ** argv ) {
try {
Py_Initialize();
object main_module((
handle<>(borrowed(PyImport_AddModule("__main__")))));
object main_namespace = main_module.attr("__dict__");
handle<> ignored(( PyRun_String( "print \"Hello, World\"",
Py_file_input,
main_namespace.ptr(),
main_namespace.ptr() ) ));
} catch( error_already_set ) {
PyErr_Print();
}
}
Due to some oddities in how Microsoft’s precompiled headers work, you always want the:
…as the firsts line in any file where you use it. Any other header needs to come after that, so you want: