[問題] linux呼叫so函式,執行出現undefined s..

看板Python作者 (曙光)時間3年前 (2021/02/16 00:28), 3年前編輯推噓1(104)
留言5則, 3人參與, 3年前最新討論串1/1
各位前輩好,目前遇到了一個問題,在建置so library檔時,呼叫內部函式出現了undefi ned symbol,目前完全不知道解決的方向,希望各位前輩能夠指導 https://i.imgur.com/7yepT73.jpg
這是我的程式碼 https://glot.io/snippets/fvwlmsu43t -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.225.58.19 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1613406501.A.169.html

02/16 00:36, 3年前 , 1F
你的.so怎麼生的?
02/16 00:36, 1F
https://glot.io/snippets/fvwlmsu43t 我是使用makefile產生的,這是我的程式碼 ※ 編輯: asd24693120 (36.225.58.19 臺灣), 02/16/2021 01:05:40 ※ 編輯: asd24693120 (36.225.58.19 臺灣), 02/16/2021 01:06:28

02/16 05:21, 3年前 , 2F
不用 include Python.h?
02/16 05:21, 2F

02/16 05:51, 3年前 , 3F
你如果只有要用幾個 function 的話參考 ctypes 看看
02/16 05:51, 3F

02/17 11:16, 3年前 , 4F
1. 沒有link到完整的lib 2. python不能直接call C++ func
02/17 11:16, 4F

02/17 11:18, 3年前 , 5F
需要用extern "C" {} 的方式宣告 function
02/17 11:18, 5F
文章代碼(AID): #1WAg4b5f (Python)