Boost logo

Boost Users :

From: Guido Ziliotti (guido.ziliotti_at_[hidden])
Date: 2007-08-24 03:04:51


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)

;

}



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net