Probably

Has anybody faced error C2976: 'boost::python::class_' : too few template arguments? Compiler msvc-8.0.

BOOST_PYTHON_MODULE(hello){

class_<World>(

"World")

.def(

"greet", &World::greet)

.def(

"set", &World::set)

;

}
 
produced that. Source code follows.
 
 

#include

<string>

char

const* greet()

{

return "hello, world";

}

struct

World

{

void set(std::string msg) { this->msg = msg; }

std::string greet() {

return msg; }

std::string msg;

};

 

#include

<boost/python/module.hpp>

#include

<boost/python/def.hpp>

using

namespace boost::python;

//nota che la funzione globale va prima

BOOST_PYTHON_MODULE(hello)

{

def(

"greet", greet);

class_<World>(

"World")

.def(

"greet", &World::greet)

.def(

"set", &World::set)

;

}