boostorg / boostorg/python

Example of boost/python/call_method.hpp does not compile

未关闭
#326 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C++
星标
537
派生
223
平均合并
11 小时 22 分钟
30 天内合并 PR
2

描述

I compilled the my_module.cpp file with the following command:
`
gcc -o my_module.o my_module.cpp -c -Wall -fPIC -I/usr/include/python3.6
`

This resulted in the following error:
```
my_module.cpp: In member function ‘virtual const char* Base_callback::class_name() const’:
my_module.cpp:31:44: error: ‘call_method’ was not declared in this scope
char const* class_name() const { return call_method(m_self, "class_name"); }
^~~~~~~~~~~
my_module.cpp:31:56: error: expected primary-expression before ‘char’
char const* class_name() const { return call_method(m_self, "class_name"); }
^~~~
my_module.cpp:31:56: error: expected ‘;’ before ‘char’
my_module.cpp:31:67: error: expected unqualified-id before ‘>’ token
char const* class_name() const { return call_method(m_self, "class_name"); }
^
my_module.cpp:31:67: error: expected initializer before ‘>’ token
my_module.cpp: In function ‘void init_module_tryout()’:
my_module.cpp:40:5: error: ‘def’ was not declared in this scope
def("is_base", is_base);
^~~
makefile:16: recipe for target 'my_module.o' failed
```

The solution was to add the following 2 include statements:
```
#include
#include
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。