This error occurs when i declare the class constructor in the c++ header
file and the definition in the .cpp file. Bjam throws up a LNK2019 error,
unresolved symbol.
But if i declare the class constructor in the header file itself, the code
compiles.
Here's the code:
*Test1.h*
#include <windows.h>
//using namespace std;
class World
{
public:
World();
~World();
void set(std::string msg) { this->msg = msg; }
std::string greet() { return msg; }
std::string msg;
};
*Test1.cpp*
#include "Test1.h"
World::World() {};
World::~World() {};
int addition(int a, int b)
{
int z = a + b;
return z;
}
*Wrapper file:*
*
#include <boost/python.hpp>
#include "Test1.h"
BOOST_PYTHON_MODULE(hello)
{
using namespace boost::python;
class_<World>("World")
.def("greet", &World::greet)
.def("set", &World::set)
;
}
Is it a compiler bug? I want to define the constructors in the cpp file, and
not the header file.
*
--
Regards,
Hitesh
_______________________________________________
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig