pybind / pybind/pybind11

[QUESTION] How to use pybind11 libary in c++?

Open
#3,157 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
18k
Forks
2.3k
Avg merge
5d 17h
Merged PRs (30d)
10

Description

I complie a c++ library which can be called by python.

i think it should be able to use for c++, but when i link it.

but i met:

//usr/local/lib/libutil_cpp.so: undefined reference to `PyCMethod_New'
//usr/local/lib/libutil_cpp.so: undefined reference to `PyThread_tss_set'
//usr/local/lib/libutil_cpp.so: undefined reference to `PyThread_tss_create'
//usr/local/lib/libutil_cpp.so: undefined reference to `PyThread_tss_get'
//usr/local/lib/libutil_cpp.so: undefined reference to `PyThread_tss_alloc'
//usr/local/lib/libutil_cpp.so: undefined reference to `PyIndex_Check'

i have linked libpython3.so, is there anything else i need to link?

Contributor guide

Open the contributing guide

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.

Research direction

The issue names no files, tests, or entry points. Start by examining the C++ link command and the reported Python symbols; this is a support question rather than a defined repository change, so no contribution-ready definition of done is provided.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.