学习 Boost.Python 时遇到了一个困难
下面这段程序核心来自Boost.Python 但是在编译的时候出现了很多问题!
望高人能给解释一下!
#pragma warning( push )
// 没有以下两句话,会产生一些 warning 虽然文件可以正常生成,但不知为何!!
#pragma warning(disable : 4244)
#pragma warning(disable : 4267)
#include <iostream>
#include <boost/python/def.hpp>
#include <boost/python/module.hpp>
#include <boost/python/args.hpp>
# ifdef _DEBUG
# pragma comment(lib, "boost_python-vc71-mt-gd-1_33_1")
# else
# pragma comment(lib, "boost_python-vc71-mt-1_33_1")
# endif
using namespace boost::python;
char const* foo(int x, int y)
{
std::cout << x << ',' << y << std::endl;
return "foo";
}
BOOST_PYTHON_MODULE(testdef)
{
// 示例中下面这句话,如果把注释中的内容也作为代码,编译将不会通过,何故?
def("foo", foo/*, args("x", "y"), "foo's docstring"*/);
}
#pragma warning( pop )