Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#326 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
cpp
Domain
backend

Research direction

Start with the my_module.cpp example and reproduce the reported gcc command using the Python 3.6 include path. Check the example's headers against the reported missing call_method and def declarations; done means the example includes the required Boost.Python headers and compiles without these errors.

Written by the indexing model from the issue text.

Description

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<char const*>(m_self, "class_name"); }
                                            ^~~~~~~~~~~
my_module.cpp:31:56: error: expected primary-expression before ‘char’
    char const* class_name() const { return call_method<char const*>(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<char const*>(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 <boost/python/call_method.hpp>
#include <boost/python/def.hpp>
Dominant language
C++
Stars
537
Forks
223
Avg merge
11h 22m
Merged PRs (30d)
2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/python

All issues in boostorg/python

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.